summaryrefslogtreecommitdiffstats
path: root/tpl/objects/badge.pug
blob: 48e4029b1b16095351a4897f64c4d34899f8de92 (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
30
31
32
33
34
35
36
37
mixin badge(variant)
    -
        let classes = {
            'o-badge':       true,
            'o-badge--pill': !!attributes.pill,
            'o-badge--quiet': !!attributes.quiet,
            'o-menu__badge': !!attributes.menu,
        }
        if (attributes.size) {
            classes['o-badge--' + attributes.size] = true
        }
        if (variant) {
            classes['o-badge--' + variant] = true
        }

    if attributes.href
        a(href=attributes.href class=classes)
            if attributes.icon
                +icon(attributes.icon)
                = ' '
            if block
                span.o-badge__label
                    block
            if attributes.postIcon
                = ' '
                +icon(attributes.postIcon)
    else
        span(class=classes)
            if attributes.icon
                +icon(attributes.icon)
                = ' '
            if block
                span.o-badge__label
                    block
            if attributes.postIcon
                = ' '
                +icon(attributes.postIcon)