summaryrefslogtreecommitdiffstats
path: root/tpl/objects/avatar.pug
blob: 9e08a16a636bb982834e59164264ac5bce4d6c9b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
include ../objects/status-indicator.pug

mixin avatar
    -
        let classes = {
            'o-avatar':         true,
            'o-avatar--circle': attributes.circle,
            'u-d-block':            attributes.block
        }
        if (attributes.class) {
            classes[attributes.class] = true;
        }
        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