From 3b7e35551b499a7b8887adb068d3a80e4088b0c2 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 5 Feb 2022 19:23:14 +0100 Subject: Added field-label --- tpl/objects/field-label.pug | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tpl/objects/field-label.pug (limited to 'tpl/objects/field-label.pug') diff --git a/tpl/objects/field-label.pug b/tpl/objects/field-label.pug new file mode 100644 index 0000000..151e084 --- /dev/null +++ b/tpl/objects/field-label.pug @@ -0,0 +1,23 @@ +mixin field-label(label, hint=null) + - + let classes = { + 'o-field-label': true, + 'o-field-label--left': attributes.align === 'left', + 'o-field-label--right': attributes.align === 'right', + 'is-invalid': attributes.invalid, + 'is-disabled': attributes.disabled, + } + if (attributes.class) { + classes[attributes.class] = true; + } + + let needsLabelWidth = attributes.align === 'left' || attributes.align === 'right'; + + let labelStyle = needsLabelWidth ? 'width: ' + attributes.labelWidth : ''; + + div(class=classes) + .o-field-label__label(style=labelStyle class=attributes.labelClass)= label + .o-field-label__content(class=attributes.contentClass) + block + if hint + .o-field-label__hint= hint -- cgit v1.2.3-54-g00ecf