blob: 151e084f6efab41d8e64aa04d5c2ed1788dc802e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
|