summaryrefslogtreecommitdiffstats
path: root/src/objects/_badge.scss
blob: 86d5ad2ad27a44b677b702e7dbf756d2bbcd65de (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;

@include iro.props-namespace('badge') {
    @include iro.props-store((
        --dims: (
            --pad-x:     fn.global-dim(--size --75),
            --pad-y:     fn.global-dim(--size --10),
            --rounding:  3px,
            --font-size: fn.global-dim(--font-size --75),
            --fixed-100: 1em,
            --fixed-200: 1.5em,

            --200: (
                --pad-x:     fn.global-dim(--size --100),
                --pad-y:     fn.global-dim(--size --50),
            )
        ),
    ), 'dims');

    @include iro.props-store((
        --colors: (
            --bg:    fn.global-color(--obj-hi),
            --label: fn.global-color(--fg-lo),
            --accent: (
                --bg:    fn.global-color(--accent --primary --bg),
                --label: fn.global-color(--accent --primary --fg),
            )
        ),
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        display:          inline-block;
        padding:          fn.dim(--pad-y) fn.dim(--pad-x);
        border-radius:    fn.dim(--rounding);
        background-color: fn.color(--bg);
        color:            fn.color(--label);
        font-size:        fn.dim(--font-size);
        text-align:       center;
    
        @include iro.bem-modifier('accent') {
            background-color: fn.color(--accent --bg);
            color:            fn.color(--accent --label);
        }
    
        @include iro.bem-modifier('fixed-100') {
            width: fn.dim(--fixed-100);
        }
    
        @include iro.bem-modifier('fixed-200') {
            width: fn.dim(--fixed-200);
        }
    
        @include iro.bem-modifier('200') {
            padding: fn.dim(--200 --pad-y) fn.dim(--200 --pad-x);
        }
    }
}