summaryrefslogtreecommitdiffstats
path: root/src/objects/_divider.scss
blob: 7d962063a1207a83a46a2b9882a74c22123964f4 (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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
@use 'sass:map';
@use 'iro-sass/src/iro-sass' as iro;
@use '../functions' as fn;
@use '../config';

$static-themes: 'black' 'white' !default;

@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 --800),
                        --label: fn.global-color($color --1000),
                    )
                ),
            ));
        }
    }

    @each $theme in $static-themes {
        @include iro.props-store((
            --colors: (
                --static-#{$theme}: (
                    --strong: (
                        --bg:    fn.global-color(--#{$theme}-transparent --800),
                        --label: fn.global-color(--#{$theme}-transparent --900),
                    ),
                    --medium: (
                        --bg:    fn.global-color(--#{$theme}-transparent --300),
                        --label: fn.global-color(--#{$theme}-transparent --500),
                    ),
                    --faint: (
                        --bg:    fn.global-color(--#{$theme}-transparent --300),
                        --label: fn.global-color(--#{$theme}-transparent --500),
                    ),
                )
            ),
        ));
    }

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

        &::before,
        &::after {
            flex:             1 1 auto;
            inline-size:      100%;
            block-size:       fn.dim(--strong --border);
            content:          '';
            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;
            inline-size:      1px;
            block-size:       auto;
            margin-block:     0;
            background-color: fn.color(--faint --bg);

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

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

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

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

            &::before,
            &::after {
                block-size:       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);
                }
            }
        }

        @each $theme in $static-themes {
            @include iro.bem-modifier(static-#{$theme}) {
                &::before,
                &::after {
                    background-color: fn.color(--static-#{$theme} --strong --bg);
                }

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

                @include iro.bem-modifier('medium') {
                    &::before,
                    &::after {
                        background-color: fn.color(--static-#{$theme} --medium --bg);
                    }
    
                    @include iro.bem-elem('label') {
                        color: fn.color(--static-#{$theme} --medium --label);
                    }
                }
    
                @include iro.bem-modifier('faint') {
                    &::before,
                    &::after {
                        background-color: fn.color(--static-#{$theme} --faint --bg);
                    }
    
                    @include iro.bem-elem('label') {
                        color: fn.color(--static-#{$theme} --faint --label);
                    }
                }
            }
        }
    }
}