diff options
Diffstat (limited to 'tpl/objects')
-rw-r--r-- | tpl/objects/button.pug | 2 | ||||
-rw-r--r-- | tpl/objects/field-label.pug | 23 | ||||
-rw-r--r-- | tpl/objects/text-field.pug | 2 |
3 files changed, 25 insertions, 2 deletions
diff --git a/tpl/objects/button.pug b/tpl/objects/button.pug index 243ff58..3b10ea0 100644 --- a/tpl/objects/button.pug +++ b/tpl/objects/button.pug | |||
@@ -12,5 +12,5 @@ mixin a-button | |||
12 | 12 | ||
13 | let href = attributes.disabled ? null : '#'; | 13 | let href = attributes.disabled ? null : '#'; |
14 | 14 | ||
15 | a(class=classes href=href) | 15 | a(class=classes href=href aria-disabled=attributes.disabled && String(attributes.disabled)) |
16 | block | 16 | block |
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 @@ | |||
1 | mixin field-label(label, hint=null) | ||
2 | - | ||
3 | let classes = { | ||
4 | 'o-field-label': true, | ||
5 | 'o-field-label--left': attributes.align === 'left', | ||
6 | 'o-field-label--right': attributes.align === 'right', | ||
7 | 'is-invalid': attributes.invalid, | ||
8 | 'is-disabled': attributes.disabled, | ||
9 | } | ||
10 | if (attributes.class) { | ||
11 | classes[attributes.class] = true; | ||
12 | } | ||
13 | |||
14 | let needsLabelWidth = attributes.align === 'left' || attributes.align === 'right'; | ||
15 | |||
16 | let labelStyle = needsLabelWidth ? 'width: ' + attributes.labelWidth : ''; | ||
17 | |||
18 | div(class=classes) | ||
19 | .o-field-label__label(style=labelStyle class=attributes.labelClass)= label | ||
20 | .o-field-label__content(class=attributes.contentClass) | ||
21 | block | ||
22 | if hint | ||
23 | .o-field-label__hint= hint | ||
diff --git a/tpl/objects/text-field.pug b/tpl/objects/text-field.pug index 9bbe0a1..9069200 100644 --- a/tpl/objects/text-field.pug +++ b/tpl/objects/text-field.pug | |||
@@ -8,6 +8,6 @@ mixin text-field | |||
8 | 'is-disabled': attributes.disabled, | 8 | 'is-disabled': attributes.disabled, |
9 | } | 9 | } |
10 | 10 | ||
11 | div(class=classes) | 11 | div(class=classes aria-disabled=attributes.disabled && String(attributes.disabled)) |
12 | input(class='o-text-field__input')&attributes(attributes) | 12 | input(class='o-text-field__input')&attributes(attributes) |
13 | .o-text-field__bg | 13 | .o-text-field__bg |