summaryrefslogtreecommitdiffstats
path: root/tpl/objects
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/objects')
-rw-r--r--tpl/objects/avatar.pug26
-rw-r--r--tpl/objects/status-indicator.pug8
2 files changed, 34 insertions, 0 deletions
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 @@
1include ../objects/status-indicator.pug
2
3mixin avatar
4 -
5 let classes = {
6 'o-avatar': true,
7 'o-avatar--circle': attributes.circle
8 }
9
10 if (attributes.size) {
11 classes['o-avatar--' + attributes.size] = true;
12 }
13
14 let styles = {}
15 if (attributes.hue) {
16 styles['--avatar--colors--h'] = attributes.hue;
17 }
18
19 div(class=classes style=styles)
20 if attributes.status
21 +status-indicator(attributes.status)(class='o-avatar__status')
22 if attributes.src
23 img.o-avatar__content(src=attributes.src)
24 else
25 .o-avatar__content
26 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 @@
1mixin status-indicator(status)
2 -
3 let classes = {
4 'o-status-indicator': true,
5 }
6 classes['is-' + status] = true
7
8 div(class=classes)&attributes(attributes)