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

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

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

    @include bem.object('navbar') {
        display:    flex;
        block-size: props.get(vars.$block-size);

        @include bem.elem('item-content-text') {
            margin-inline: props.get(vars.$item--pad-i-label);
        }

        @include bem.elem('item-content') {
            position:        relative;
            padding-block:   props.get(vars.$item--pad-b);
            padding-inline:  props.get(vars.$item--pad-i);
            font-size:       props.get(vars.$item--font-size);
            color:           currentColor;
            border-radius:   100em;

            &::after {
                position:       absolute;
                inset:          calc(-1 * props.get(vars.$key-focus--border-offset));
                z-index:        1;
                display:        none;
                pointer-events: none;
                content:        '';
                border-radius:  100em;
                outline:        props.get(vars.$default-theme, --key-focus, --border) solid props.get(vars.$key-focus--border-width);
                box-shadow:
                    0
                    0
                    0
                    calc(props.get(vars.$key-focus--border-width) + props.get(vars.$key-focus--outline-width))
                    props.get(vars.$default-theme, --key-focus, --outline);
            }
        }

        @include bem.elem('item') {
            display:         flex;
            flex-direction:  column;
            align-items:     center;
            justify-content: center;
            inline-size:     100%;
            padding-inline:  calc(.5 * props.get(vars.$spacing));
            font-weight:     500;
            color:           props.get(vars.$default-theme, --disabled, --label-color);

            &:link,
            &:visited,
            &:enabled {
                color: props.get(vars.$default-theme, --label-color);

                &:hover,
                &:focus-visible {
                    color: props.get(vars.$default-theme, --hover, --label-color);

                    @include bem.elem('item-content') {
                        background-color: props.get(vars.$default-theme, --hover, --bg-color);
                    }
                }

                &:focus-visible {
                    @include bem.elem('item-content') {
                        &::after {
                            display: block;
                        }
                    }
                }

                &:active {
                    color: props.get(vars.$default-theme, --active, --label-color);

                    @include bem.elem('item-content') {
                        background-color: props.get(vars.$default-theme, --active, --bg-color);
                    }
                }
            }

            @include bem.is('selected') {
                font-weight: bold;
                color:       props.get(vars.$default-theme, --selected, --disabled, --label-color);

                @include bem.elem('item-content') {
                    background-color: props.get(vars.$default-theme, --selected, --disabled, --bg-color);
                }

                &:link,
                &:visited,
                &:enabled {
                    color: props.get(vars.$default-theme, --selected, --label-color);

                    @include bem.elem('item-content') {
                        background-color: props.get(vars.$default-theme, --selected, --bg-color);
                    }

                    &:hover,
                    &:focus-visible {
                        color: props.get(vars.$default-theme, --selected, --hover, --label-color);

                        @include bem.elem('item-content') {
                            background-color: props.get(vars.$default-theme, --selected, --hover, --bg-color);
                        }
                    }

                    &:active {
                        color: props.get(vars.$default-theme, --selected, --active, --label-color);

                        @include bem.elem('item-content') {
                            background-color: props.get(vars.$default-theme, --selected, --active, --bg-color);
                        }
                    }
                }
            }
        }

        @include bem.modifier('hide-unselected') {
            @include bem.elem('item') {
                display: none;

                @include bem.is('selected') {
                    display: flex;
                }
            }
        }

        @include bem.modifier('adapt') {
            gap:        props.get(vars.$spacing);
            block-size: 100%;

            @include bem.elem('item') {
                padding-inline: 0;
            }
        }


        @include bem.modifier('align-block') {
            margin-inline: calc(-1 * props.get(vars.$item--pad-i));
        }

        @include bem.modifier('quiet') {
            @include bem.elem('item') {
                @include bem.is('selected') {
                    color: props.get(vars.$default-theme, --quiet, --selected, --disabled, --label-color);

                    @include bem.elem('item-content') {
                        background-color: props.get(vars.$default-theme, --quiet, --selected, --disabled, --bg-color);
                    }

                    &:link,
                    &:visited,
                    &:enabled {
                        color: props.get(vars.$default-theme, --quiet, --selected, --label-color);

                        @include bem.elem('item-content') {
                            background-color: props.get(vars.$default-theme, --quiet, --selected, --bg-color);
                        }

                        &:hover,
                        &:focus-visible {
                            color: props.get(vars.$default-theme, --quiet, --selected, --hover, --label-color);

                            @include bem.elem('item-content') {
                                background-color: props.get(vars.$default-theme, --quiet, --selected, --hover, --bg-color);
                            }
                        }

                        &:active {
                            color: props.get(vars.$default-theme, --quiet, --selected, --active, --label-color);

                            @include bem.elem('item-content') {
                                background-color: props.get(vars.$default-theme, --quiet, --selected, --active, --bg-color);
                            }
                        }
                    }
                }
            }
        }
    }
}