summaryrefslogtreecommitdiffstats
path: root/src/objects/_divider.scss
blob: 65f1718bbe9d4b540804b0c27c995f8eae9c931c (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
@use 'sass:map';
@use 'sass:meta';
@use 'sass:string';
@use 'iro-sass/src/bem';
@use 'iro-sass/src/props';
@use '../props' as *;
@use '../core.vars' as core;

@forward 'divider.vars';
@use 'divider.vars' as vars;

@mixin styles {
    @include materialize-at-root(meta.module-variables('vars'));

    @include bem.object('divider') {
        display:          flex;
        flex:             0 0 auto;
        flex-direction:   row;
        align-items:      center;
        block-size:       1em;
        margin-block:     props.get(vars.$margin-b);
        font-size:        props.get(vars.$strong--label-font-size);
        font-weight:      700;
        line-height:      1;
        color:            props.get(vars.$strong--label-color);
        text-transform:   uppercase;
        letter-spacing:   .5px;
        background-color: transparent;

        &::before,
        &::after {
            flex:             1 1 auto;
            inline-size:      100%;
            block-size:       props.get(vars.$strong--border-width);
            content:          '';
            background-color: props.get(vars.$strong--bg-color);
        }

        &::before {
            display: block;
        }

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

        @include bem.modifier('vertical') {
            align-self:       stretch;
            inline-size:      1px;
            block-size:       auto;
            margin-block:     0;
            background-color: props.get(vars.$faint--bg-color);

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

        @include bem.modifier('medium') {
            font-size:   props.get(vars.$medium--label-font-size);
            font-weight: 500;
            color:       props.get(vars.$medium--label-color);

            &::before,
            &::after {
                block-size:       props.get(vars.$medium--border-width);
                background-color: props.get(vars.$medium--bg-color);
            }
        }

        @include bem.modifier('faint') {
            font-size:   props.get(vars.$faint--label-font-size);
            font-weight: 500;
            color:       props.get(vars.$faint--label-color);

            &::before,
            &::after {
                block-size:       props.get(vars.$faint--border-width);
                background-color: props.get(vars.$faint--bg-color);
            }

            @include bem.modifier('vertical') {
                background-color: props.get(vars.$vertical--faint--bg-color);
            }
        }

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

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

        @each $theme in map.keys(props.get(vars.$themes)) {
            @include bem.modifier(string.slice($theme, 3)) {
                &::before,
                &::after {
                    background-color: props.get(vars.$themes, $theme, --bg);
                }

                @include bem.elem('label') {
                    color: props.get(vars.$themes, $theme, --label);
                }
            }
        }

        @each $theme in map.keys(props.get(vars.$static-themes)) {
            @include bem.modifier(string.slice($theme, 3)) {
                &::before,
                &::after {
                    background-color: props.get(vars.$static-themes, $theme, --strong, --bg);
                }

                @include bem.elem('label') {
                    color: props.get(vars.$static-themes, $theme, --strong, --label);
                }

                @include bem.modifier('medium') {
                    &::before,
                    &::after {
                        background-color: props.get(vars.$static-themes, $theme, --medium, --bg);
                    }
    
                    @include bem.elem('label') {
                        color: props.get(vars.$static-themes, $theme, --medium, --label);
                    }
                }
    
                @include bem.modifier('faint') {
                    &::before,
                    &::after {
                        background-color: props.get(vars.$static-themes, $theme, --faint, --bg);
                    }
    
                    @include bem.elem('label') {
                        color: props.get(vars.$static-themes, $theme, --faint, --label);
                    }
                }
            }
        }
    }
}