summaryrefslogtreecommitdiffstats
path: root/tpl
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2022-02-07 18:37:09 +0100
committerVolpeon <git@volpeon.ink>2022-02-07 18:37:09 +0100
commit8f49d0cba610e4829e183e81e4126aba136dfccc (patch)
tree528b2260c3c8aa2f5d544691797d4f8e7e008625 /tpl
parentUpdate (diff)
downloadiro-design-8f49d0cba610e4829e183e81e4126aba136dfccc.tar.gz
iro-design-8f49d0cba610e4829e183e81e4126aba136dfccc.tar.bz2
iro-design-8f49d0cba610e4829e183e81e4126aba136dfccc.zip
Added action-menu
Diffstat (limited to 'tpl')
-rw-r--r--tpl/index.pug15
-rw-r--r--tpl/objects/action-button.pug37
-rw-r--r--tpl/objects/action-menu.pug25
-rw-r--r--tpl/objects/icon.pug15
-rw-r--r--tpl/objects/status-indicator.pug5
5 files changed, 74 insertions, 23 deletions
diff --git a/tpl/index.pug b/tpl/index.pug
index 206e40b..a59526e 100644
--- a/tpl/index.pug
+++ b/tpl/index.pug
@@ -15,6 +15,7 @@ include objects/form.pug
15include objects/action-button.pug 15include objects/action-button.pug
16include objects/status-indicator.pug 16include objects/status-indicator.pug
17include objects/avatar.pug 17include objects/avatar.pug
18include objects/action-menu.pug
18 19
19mixin box 20mixin box
20 +container(padX=true padY=true inPage=true theme="raised") 21 +container(padX=true padY=true inPage=true theme="raised")
@@ -435,3 +436,17 @@ html
435 +avatar(circle=true size='xs' hue=225) 436 +avatar(circle=true size='xs' hue=225)
436 = 'o' 437 = 'o'
437 +avatar(circle=true size='xs' src='avatar.png') 438 +avatar(circle=true size='xs' src='avatar.png')
439
440 //-----------------------------------------
441
442 +h1-heading(level='xl')= 'Action menu'
443 +rule(level='medium')
444
445 +box
446 +action-menu
447 +action-menu-item(icon='trash')= 'Item 1'
448 +action-menu-item= 'Item 2'
449 +action-menu-item= 'Item 3'
450 +action-menu-separator
451 +action-menu-item= 'Item 4'
452
diff --git a/tpl/objects/action-button.pug b/tpl/objects/action-button.pug
index 0afe1ea..eb524a2 100644
--- a/tpl/objects/action-button.pug
+++ b/tpl/objects/action-button.pug
@@ -1,21 +1,24 @@
1include icon.pug 1include icon.pug
2 2
3mixin action-button 3mixin action-button
4 - 4 -
5 let classes = { 5 let classes = {
6 'o-action-button': true, 6 'o-action-button': true,
7 'o-action-button--block': attributes.block, 7 'o-action-button--block': attributes.block,
8 'o-action-button--quiet': attributes.quiet, 8 'o-action-button--quiet': attributes.quiet,
9 'is-disabled': attributes.disabled, 9 'is-disabled': attributes.disabled,
10 'is-selected': attributes.selected 10 'is-selected': attributes.selected
11 } 11 }
12 12 if (attributes.class) {
13 let href = attributes.disabled ? null : '#'; 13 classes[attributes.class] = true;
14 }
14 15
15 a(class=classes href=href) 16 let href = attributes.disabled ? null : '#';
16 if attributes.icon 17
17 +icon(attributes.icon) 18 a(class=classes href=href)
18 = ' ' 19 if attributes.icon
19 if block 20 +icon(attributes.icon)
20 span.o-action-button__label 21 = ' '
21 block 22 if block
23 span.o-action-button__label
24 block
diff --git a/tpl/objects/action-menu.pug b/tpl/objects/action-menu.pug
new file mode 100644
index 0000000..85f93bf
--- /dev/null
+++ b/tpl/objects/action-menu.pug
@@ -0,0 +1,25 @@
1include ../objects/action-button.pug
2include icon.pug
3
4mixin action-menu
5 -
6 let classes = {
7 'o-action-menu': true,
8 'o-action-menu--static': true,
9 't-raised': true
10 }
11
12 div(class=classes)
13 block
14
15mixin action-menu-item
16 button.o-action-menu__item.o-action-menu__item--native
17 .l-card.l-card--flush
18 .l-card__block.o-action-menu__icon-slot
19 if attributes.icon
20 +icon(attributes.icon)
21 .l-card__block.l-card__block--main
22 block
23
24mixin action-menu-separator
25 .o-action-menu__separator
diff --git a/tpl/objects/icon.pug b/tpl/objects/icon.pug
index 0e444f9..494abf6 100644
--- a/tpl/objects/icon.pug
+++ b/tpl/objects/icon.pug
@@ -1,7 +1,12 @@
1mixin icon(id) 1mixin icon(id)
2 - 2 -
3 let href = 'icons.svg#' + id 3 let href = 'icons.svg#' + id
4 let classes = attributes.class ? attributes.class : '' 4 let classes = {
5 'o-icon': true
6 }
7 if (attributes.class) {
8 classes[attributes.class] = true;
9 }
5 10
6 svg(class=['o-icon', classes] width='1em' height='1em') 11 svg(class=classes width='1em' height='1em')
7 use(href=href) 12 use(href=href)
diff --git a/tpl/objects/status-indicator.pug b/tpl/objects/status-indicator.pug
index 9b240e1..7ecb08a 100644
--- a/tpl/objects/status-indicator.pug
+++ b/tpl/objects/status-indicator.pug
@@ -4,5 +4,8 @@ mixin status-indicator(status)
4 'o-status-indicator': true, 4 'o-status-indicator': true,
5 } 5 }
6 classes['is-' + status] = true 6 classes['is-' + status] = true
7 if (attributes.class) {
8 classes[attributes.class] = true;
9 }
7 10
8 div(class=classes)&attributes(attributes) 11 div(class=classes)