summaryrefslogtreecommitdiffstats
path: root/tpl/objects
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2022-02-05 19:23:14 +0100
committerVolpeon <git@volpeon.ink>2022-02-05 19:23:14 +0100
commit3b7e35551b499a7b8887adb068d3a80e4088b0c2 (patch)
treee8aa73b422b7d112be2a9deb00c86e3b7cc77749 /tpl/objects
parentAdded text field (diff)
downloadiro-design-3b7e35551b499a7b8887adb068d3a80e4088b0c2.tar.gz
iro-design-3b7e35551b499a7b8887adb068d3a80e4088b0c2.tar.bz2
iro-design-3b7e35551b499a7b8887adb068d3a80e4088b0c2.zip
Added field-label
Diffstat (limited to 'tpl/objects')
-rw-r--r--tpl/objects/button.pug2
-rw-r--r--tpl/objects/field-label.pug23
-rw-r--r--tpl/objects/text-field.pug2
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 @@
1mixin 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