From 69d753931c098bc18cd23e96af18f736a772f416 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 22 Jun 2024 23:00:16 +0200 Subject: Update --- tpl/objects/button.pug | 5 ++++- tpl/objects/field-label.pug | 13 +++++++------ tpl/objects/text-field.pug | 6 +++++- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'tpl/objects') 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 if (attributes.variant) { classes['o-button--' + attributes.variant] = true } + if (attributes.size) { + classes['o-button--' + attributes.size] = true + } let href = attributes.disabled ? null : '#'; a(class=classes href=href aria-disabled=attributes.disabled && String(attributes.disabled)) if attributes.icon - +icon(attributes.icon)(block=!block) + +icon(attributes.icon) = ' ' 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 @@ 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, + 'o-field-label': true, + 'is-invalid': attributes.invalid, + 'is-disabled': attributes.disabled, + } + if (attributes.align) { + classes['o-field-label--align-' + attributes.align] = true; } if (attributes.class) { classes[attributes.class] = true; } - let needsLabelWidth = attributes.align === 'left' || attributes.align === 'right'; + let needsLabelWidth = !!attributes.align; let labelStyle = needsLabelWidth ? 'width: ' + attributes.labelWidth : ''; 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 const attr = { placeholder: attributes.placeholder, - disabled: attributes.disabled + disabled: attributes.disabled, + readonly: attributes.readonly, + pattern: attributes.pattern, + required: attributes.required, + value: attributes.value, } div(class=classes aria-disabled=attributes.disabled && String(attributes.disabled)) -- cgit v1.2.3-54-g00ecf