summaryrefslogtreecommitdiffstats
path: root/src/objects/_divider.scss
blob: 333233133d33db29d3759265b7c33d370da5d9f1 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
@use 'sass:map';
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;
@use '../config';

@include iro.props-namespace('divider') {
    @include iro.props-store((
        --dims: (
            --margin-b: fn.global-dim(--size --85),
    
            --strong: (
                --border:          fn.global-dim(--border --thick),
                --label-font-size: fn.global-dim(--font-size --100),
            ),
            --medium: (
                --border:          fn.global-dim(--border --medium),
                --label-font-size: fn.global-dim(--font-size --75),
            ),
            --faint: (
                --border:          fn.global-dim(--border --thin),
                --label-font-size: fn.global-dim(--font-size --50),
            ),
        ),
        --colors: (
            --strong: (
                --bg:    fn.global-color(--text),
                --label: fn.global-color(--text),
            ),
            --medium: (
                --bg:    fn.global-color(--border),
                --label: fn.global-color(--text-mute),
            ),
            --faint: (
                --bg:    fn.global-color(--border),
                --label: fn.global-color(--text-mute-more),
            ),
        ),
    ));

    @each $color in map.keys(map.get(config.$themes, config.$theme-default, --palettes)) {
        @if $color != '--base' {
            @include iro.props-store((
                --colors: (
                    $color: (
                        --bg:    fn.global-color($color --700),
                        --label: fn.global-color($color --1000),
                    )
                ),
            ));
        }
    }

    @include iro.bem-object(iro.props-namespace()) {
        display:        flex;
        flex-direction: row;
        align-items:    center;
        height:         1em;
        margin-block:   fn.dim(--margin-b);
        color:          fn.color(--strong --label);
        font-size:      fn.dim(--strong --label-font-size);
        font-weight:    700;
        letter-spacing: .5px;
        line-height:    1;
        text-transform: uppercase;

        &::before,
        &::after {
            content:          '';
            flex:             1 1 auto;
            width:            100%;
            height:           fn.dim(--strong --border);
            background-color: fn.color(--strong --bg);
        }

        &::before {
            display: block;
        }

        @include iro.bem-elem('label') {
            flex: 0 0 auto;
        }

        @include iro.bem-modifier('vertical') {
            align-self:       stretch;
            width:            1px;
            height:           auto;
            margin-block:     0;
            background-color: fn.color(--faint --bg);

            &::before,
            &::after {
                display: none;
            }
        }

        @include iro.bem-modifier('medium') {
            color:       fn.color(--medium --label);
            font-size:   fn.dim(--medium --label-font-size);
            font-weight: 500;

            &::before,
            &::after {
                height:           fn.dim(--medium --border);
                background-color: fn.color(--medium --bg);
            }
        }

        @include iro.bem-modifier('faint') {
            color:       fn.color(--faint --label);
            font-size:   fn.dim(--faint --label-font-size);
            font-weight: 500;

            &::before,
            &::after {
                height:           fn.dim(--faint --border);
                background-color: fn.color(--faint --bg);
            }
        }

        @include iro.bem-modifier('labelled') {
            &::before {
                margin-inline-end: 1em;
            }

            &::after {
                display:             block;
                margin-inline-start: 1em;
            }
        }

        @each $color in 'blue' 'purple' 'red' 'green' 'yellow' {
            @include iro.bem-modifier($color) {
                &::before,
                &::after {
                    background-color: fn.color(--#{$color} --bg);
                }

                @include iro.bem-elem('label') {
                    color: fn.color(--#{$color} --label);
                }
            }
        }
    }
}