From 5c878876d3bdd2c7cd094871fa0644f3310bcec8 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 23 Jul 2025 08:34:23 +0200 Subject: Commit merge of button and badge into action-button (and rename it to button) --- tpl/objects/button.pug | 56 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 18 deletions(-) (limited to 'tpl/objects/button.pug') diff --git a/tpl/objects/button.pug b/tpl/objects/button.pug index 0884c8d..b9b4cbd 100644 --- a/tpl/objects/button.pug +++ b/tpl/objects/button.pug @@ -1,28 +1,48 @@ -mixin a-button +include icon.pug + +mixin button - let classes = { - 'o-button': true, - 'o-button--block': attributes.block, - 'o-button--primary': attributes.primary, - 'o-button--outline': attributes.outline, - 'o-button--round': !!attributes.icon && !block + 'o-button': true, + 'u-d-block': attributes.block, + 'o-button--secondary': attributes.secondary, + 'o-button--quiet': attributes.quiet, + 'o-button--pill': attributes.pill, + 'o-button--static': attributes.static, + 'o-button--icon': !!attributes.icon && !block, + 'is-selected': attributes.selected, } - if (attributes.variant) { - classes['o-button--' + attributes.variant] = true + if (attributes.theme) { + classes['o-button--' + attributes.theme] = true } if (attributes.size) { classes['o-button--' + attributes.size] = true } + if (attributes.class) { + classes[attributes.class] = true; + } let href = attributes.disabled ? null : '#'; - a(class=classes href=href aria-disabled=attributes.disabled && String(attributes.disabled)) - if attributes.icon - +icon(attributes.icon) - = ' ' - if block - span.o-button__label - block - if attributes.postIcon - = ' ' - +icon(attributes.postIcon) + if attributes.badge + span(class=classes href=href) + if attributes.icon + +icon(attributes.icon) + = ' ' + if block + span.o-button__label + block + if attributes.postIcon + = ' ' + +icon(attributes.postIcon) + else + a(class=classes href=href) + if attributes.icon + +icon(attributes.icon) + = ' ' + if block + span.o-button__label + block + if attributes.postIcon + = ' ' + +icon(attributes.postIcon) -- cgit v1.2.3-70-g09d2