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/objects/avatar.pug | 26 ++++++++++++++++++++++++++ tpl/objects/status-indicator.pug | 8 ++++++++ 2 files changed, 34 insertions(+) create mode 100644 tpl/objects/avatar.pug create mode 100644 tpl/objects/status-indicator.pug (limited to 'tpl/objects') 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