summaryrefslogtreecommitdiffstats
path: root/tpl/objects
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/objects')
-rw-r--r--tpl/objects/button.pug5
-rw-r--r--tpl/objects/field-label.pug13
-rw-r--r--tpl/objects/text-field.pug6
3 files changed, 16 insertions, 8 deletions
diff --git a/tpl/objects/button.pug b/tpl/objects/button.pug
index e99e5ab..61ba0b6 100644
--- a/tpl/objects/button.pug
+++ b/tpl/objects/button.pug
@@ -9,11 +9,14 @@ mixin a-button
9 if (attributes.variant) { 9 if (attributes.variant) {
10 classes['o-button--' + attributes.variant] = true 10 classes['o-button--' + attributes.variant] = true
11 } 11 }
12 if (attributes.size) {
13 classes['o-button--' + attributes.size] = true
14 }
12 15
13 let href = attributes.disabled ? null : '#'; 16 let href = attributes.disabled ? null : '#';
14 17
15 a(class=classes href=href aria-disabled=attributes.disabled && String(attributes.disabled)) 18 a(class=classes href=href aria-disabled=attributes.disabled && String(attributes.disabled))
16 if attributes.icon 19 if attributes.icon
17 +icon(attributes.icon)(block=!block) 20 +icon(attributes.icon)
18 = ' ' 21 = ' '
19 block 22 block
diff --git a/tpl/objects/field-label.pug b/tpl/objects/field-label.pug
index 151e084..fb96443 100644
--- a/tpl/objects/field-label.pug
+++ b/tpl/objects/field-label.pug
@@ -1,17 +1,18 @@
1mixin field-label(label, hint=null) 1mixin field-label(label, hint=null)
2 - 2 -
3 let classes = { 3 let classes = {
4 'o-field-label': true, 4 'o-field-label': true,
5 'o-field-label--left': attributes.align === 'left', 5 'is-invalid': attributes.invalid,
6 'o-field-label--right': attributes.align === 'right', 6 'is-disabled': attributes.disabled,
7 'is-invalid': attributes.invalid, 7 }
8 'is-disabled': attributes.disabled, 8 if (attributes.align) {
9 classes['o-field-label--align-' + attributes.align] = true;
9 } 10 }
10 if (attributes.class) { 11 if (attributes.class) {
11 classes[attributes.class] = true; 12 classes[attributes.class] = true;
12 } 13 }
13 14
14 let needsLabelWidth = attributes.align === 'left' || attributes.align === 'right'; 15 let needsLabelWidth = !!attributes.align;
15 16
16 let labelStyle = needsLabelWidth ? 'width: ' + attributes.labelWidth : ''; 17 let labelStyle = needsLabelWidth ? 'width: ' + attributes.labelWidth : '';
17 18
diff --git a/tpl/objects/text-field.pug b/tpl/objects/text-field.pug
index 895770d..f8e5263 100644
--- a/tpl/objects/text-field.pug
+++ b/tpl/objects/text-field.pug
@@ -24,7 +24,11 @@ mixin text-field
24 24
25 const attr = { 25 const attr = {
26 placeholder: attributes.placeholder, 26 placeholder: attributes.placeholder,
27 disabled: attributes.disabled 27 disabled: attributes.disabled,
28 readonly: attributes.readonly,
29 pattern: attributes.pattern,
30 required: attributes.required,
31 value: attributes.value,
28 } 32 }
29 33
30 div(class=classes aria-disabled=attributes.disabled && String(attributes.disabled)) 34 div(class=classes aria-disabled=attributes.disabled && String(attributes.disabled))