From 9691ccf48f64dd0fac669ae51943907cc8da9b78 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 6 Feb 2022 20:23:11 +0100 Subject: Added status indicator and avatar --- tpl/index.pug | 72 ++++++++++++++++++++++++++++++++++++++++ tpl/objects/avatar.pug | 26 +++++++++++++++ tpl/objects/status-indicator.pug | 8 +++++ 3 files changed, 106 insertions(+) create mode 100644 tpl/objects/avatar.pug create mode 100644 tpl/objects/status-indicator.pug (limited to 'tpl') diff --git a/tpl/index.pug b/tpl/index.pug index 2980016..206e40b 100644 --- a/tpl/index.pug +++ b/tpl/index.pug @@ -13,6 +13,8 @@ include objects/checkbox.pug include objects/switch.pug include objects/form.pug include objects/action-button.pug +include objects/status-indicator.pug +include objects/avatar.pug mixin box +container(padX=true padY=true inPage=true theme="raised") @@ -363,3 +365,73 @@ html = ' ' +action-button(quiet=true icon='trash' selected=true disabled=true) + //----------------------------------------- + + +h1-heading(level='xl')= 'Status indicator' + +rule(level='medium') + + +box + +status-indicator + = ' ' + +status-indicator('green') + = ' ' + +status-indicator('yellow') + = ' ' + +status-indicator('red') + + //----------------------------------------- + + +h1-heading(level='xl')= 'Avatar' + +rule(level='medium') + + +box + div(style={ display: 'flex', gap: '.3em' }) + +avatar + = 'Vo' + +avatar(status='green' hue=45) + = 'lp' + +avatar(src='avatar.png') + +avatar(src='avatar.png' status='red') + br + br + div(style={ display: 'flex', gap: '.3em' }) + +avatar(size='sm' hue=90) + = 'eo' + +avatar(size='sm' status='green' hue=135) + = 'n' + +avatar(size='sm' src='avatar.png') + +avatar(size='sm' src='avatar.png' status='red') + br + br + div(style={ display: 'flex', gap: '.3em' }) + +avatar(size='xs' hue=180) + = 'V' + +avatar(size='xs' hue=225) + = 'o' + +avatar(size='xs' src='avatar.png') + + +box + div(style={ display: 'flex', gap: '.3em' }) + +avatar(circle=true) + = 'Vo' + +avatar(circle=true status='green' hue=45) + = 'lp' + +avatar(circle=true src='avatar.png') + +avatar(circle=true src='avatar.png' status='red') + br + br + div(style={ display: 'flex', gap: '.3em' }) + +avatar(circle=true size='sm' hue=90) + = 'eo' + +avatar(circle=true size='sm' status='green' hue=135) + = 'n' + +avatar(circle=true size='sm' src='avatar.png') + +avatar(circle=true size='sm' src='avatar.png' status='red') + br + br + div(style={ display: 'flex', gap: '.3em' }) + +avatar(circle=true size='xs' hue=180) + = 'V' + +avatar(circle=true size='xs' hue=225) + = 'o' + +avatar(circle=true size='xs' src='avatar.png') diff --git a/tpl/objects/avatar.pug b/tpl/objects/avatar.pug new file mode 100644 index 0000000..83c0f7c --- /dev/null +++ b/tpl/objects/avatar.pug @@ -0,0 +1,26 @@ +include ../objects/status-indicator.pug + +mixin avatar + - + let classes = { + 'o-avatar': true, + 'o-avatar--circle': attributes.circle + } + + if (attributes.size) { + classes['o-avatar--' + attributes.size] = true; + } + + let styles = {} + if (attributes.hue) { + styles['--avatar--colors--h'] = attributes.hue; + } + + div(class=classes style=styles) + if attributes.status + +status-indicator(attributes.status)(class='o-avatar__status') + if attributes.src + img.o-avatar__content(src=attributes.src) + else + .o-avatar__content + block diff --git a/tpl/objects/status-indicator.pug b/tpl/objects/status-indicator.pug new file mode 100644 index 0000000..9b240e1 --- /dev/null +++ b/tpl/objects/status-indicator.pug @@ -0,0 +1,8 @@ +mixin status-indicator(status) + - + let classes = { + 'o-status-indicator': true, + } + classes['is-' + status] = true + + div(class=classes)&attributes(attributes) -- cgit v1.2.3-70-g09d2