summaryrefslogtreecommitdiffstats
path: root/tpl/objects/button.pug
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/objects/button.pug')
-rw-r--r--tpl/objects/button.pug56
1 files changed, 38 insertions, 18 deletions
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 @@
1mixin a-button 1include icon.pug
2
3mixin button
2 - 4 -
3 let classes = { 5 let classes = {
4 'o-button': true, 6 'o-button': true,
5 'o-button--block': attributes.block, 7 'u-d-block': attributes.block,
6 'o-button--primary': attributes.primary, 8 'o-button--secondary': attributes.secondary,
7 'o-button--outline': attributes.outline, 9 'o-button--quiet': attributes.quiet,
8 'o-button--round': !!attributes.icon && !block 10 'o-button--pill': attributes.pill,
11 'o-button--static': attributes.static,
12 'o-button--icon': !!attributes.icon && !block,
13 'is-selected': attributes.selected,
9 } 14 }
10 if (attributes.variant) { 15 if (attributes.theme) {
11 classes['o-button--' + attributes.variant] = true 16 classes['o-button--' + attributes.theme] = true
12 } 17 }
13 if (attributes.size) { 18 if (attributes.size) {
14 classes['o-button--' + attributes.size] = true 19 classes['o-button--' + attributes.size] = true
15 } 20 }
21 if (attributes.class) {
22 classes[attributes.class] = true;
23 }
16 24
17 let href = attributes.disabled ? null : '#'; 25 let href = attributes.disabled ? null : '#';
18 26
19 a(class=classes href=href aria-disabled=attributes.disabled && String(attributes.disabled)) 27 if attributes.badge
20 if attributes.icon 28 span(class=classes href=href)
21 +icon(attributes.icon) 29 if attributes.icon
22 = ' ' 30 +icon(attributes.icon)
23 if block 31 = ' '
24 span.o-button__label 32 if block
25 block 33 span.o-button__label
26 if attributes.postIcon 34 block
27 = ' ' 35 if attributes.postIcon
28 +icon(attributes.postIcon) 36 = ' '
37 +icon(attributes.postIcon)
38 else
39 a(class=classes href=href)
40 if attributes.icon
41 +icon(attributes.icon)
42 = ' '
43 if block
44 span.o-button__label
45 block
46 if attributes.postIcon
47 = ' '
48 +icon(attributes.postIcon)