summaryrefslogtreecommitdiffstats
path: root/tpl/objects/field-label.pug
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/field-label.pug
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/field-label.pug')
-rw-r--r--tpl/objects/field-label.pug23
1 files changed, 23 insertions, 0 deletions
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