-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmainnavigation.scss
263 lines (221 loc) · 5.46 KB
/
mainnavigation.scss
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
@import "../../../css/partials.meta";
@import "../../00-base/icons/icon";
// TODO: Replace magic numbers e.g. with flexbox implementations and extract variables as well for multi-brand
@import "mainnavigation.variables";
.cmp-mainnavigation {
position: $mainnavigation---position;
top: $mainnavigation---position-top;
.rea-header & {
order: 1;
}
// Header Components positioning, :has non-supporting browsers fallback
@supports not selector(:has(db)) {
margin: auto;
}
// The links shouldn't get an underline as text-decoration
.elm-link {
// We need to reset the general border-radius here
border-radius: initial;
color: inherit;
display: inline-block;
text-decoration: none;
}
// Navigation toggle elements
& > input[type="checkbox"][id] {
@include a11y-visually-hidden($partial: $partial);
@media screen and (min-width: 1024px) {
// Hiding the navigation toggle elements on huger viewports
&,
& + label[for] {
display: none;
}
}
}
& > label[for] {
@include icon(glyph(menu), 24, "outline", $partial: $partial);
@include icon(glyph(close), 24, "outline", "after", $partial: $partial);
background-color: $header---backgroundColor; // TODO: This would need to get replaced by the correct (semantic) color
border-bottom: 1px solid $db-color-warm-gray-100;
display: block;
padding: to-rem($pxValue: 8) to-rem($pxValue: 22) to-rem($pxValue: 10);
&::before {
margin-right: to-rem($pxValue: 16);
}
&::after {
position: absolute;
right: to-rem($pxValue: 16);
transform: translateY(to-rem($pxValue: 2));
}
}
// Displaying the main navigation as an top to bottom overlay on smaller viewports
@media screen and (max-width: 1023px) {
background-color: $db-color-cool-gray-600;
left: 0;
position: absolute;
top: to-rem($pxValue: 64);
width: 100vw;
z-index: $z-index-cmp-mainnavigation-dropdown; // * TODO: possibly rework variable naming
& > input[type="checkbox"][id]:not(:checked) {
// Hiding the cross on collapsed navigation
& + label[for] {
&::after {
content: none;
}
}
// Hiding the navigation
& ~ ul {
display: none;
}
}
}
ul {
background-color: $header---backgroundColor;
}
// Multiple level navigation
ul ul {
@media screen and (min-width: 1024px) {
box-shadow: $box-shadow-01, $box-shadow-02;
position: absolute;
visibility: hidden;
z-index: $z-index-rea-header-cmp-mainnavigation-submenu;
}
@media screen and (max-width: 1023px) {
display: none;
}
}
// First Level
& > ul {
@media screen and (min-width: 1024px) {
display: flex;
}
& > li,
& > * > li {
& > .elm-link,
& > * > .elm-link {
@media screen and (min-width: 1024px) {
padding: $mainnavigation-link--paddingTop
to-rem($pxValue: 26) $mainnavigation-link--paddingBottom;
border-#{$mainnavigation-link--borderPosition}: 4px solid
transparent;
&:hover,
&:focus {
border-#{$mainnavigation-link--borderPosition}-color: $db-color-cool-gray-200;
}
&[aria-current="page"] {
border-#{$mainnavigation-link--borderPosition}-color: $db-color-red-500;
}
}
}
// From second level
ul {
@media screen and (min-width: 1024px) {
left: 0;
min-width: 100%;
top: to-rem($pxValue: 79);
// From third level
ul {
left: 100%;
top: auto;
transform: translateY(-#{to-rem($pxValue: 53)});
}
.elm-link {
align-items: center;
display: flex;
min-height: to-rem($pxValue: 53);
padding-left: to-rem($pxValue: 18);
padding-right: to-rem($pxValue: 18);
}
}
& > li,
& > * > li {
& > .elm-link,
& > * > .elm-link {
@media screen and (max-width: 1023px) {
padding-left: to-rem($pxValue: 34);
}
}
// Third level
ul {
& > li,
& > * > li {
& > .elm-link,
& > * > .elm-link {
@media screen and (max-width: 1023px) {
padding-left: to-rem($pxValue: 60);
}
}
}
}
}
}
}
}
li {
display: block;
// lower levels
position: relative;
// Icon for menu
// TODO: this could probably get simplified with a media query polyfill and moved back to the previous section
&[aria-haspopup="true"] {
@include icon(
glyph(chevron-right),
24,
"outline",
"after",
$partial: $partial
);
&::after {
position: absolute;
right: 1rem;
top: to-rem($pxValue: 9);
}
}
&:hover {
& > ul,
& > * > ul {
visibility: visible;
@media screen and (max-width: 1023px) {
display: initial;
}
}
}
@media screen and (max-width: 1023px) {
background-color: $db-color-cool-gray-600;
color: #fdfdfd; // TODO: This would need to get replaced by the correct (semantic) color
&:hover {
background-color: $db-color-cool-gray-300;
color: $db-color-cool-gray-800;
& > a {
font-weight: 700;
}
}
.elm-link {
color: inherit;
padding-bottom: to-rem($pxValue: 8);
padding-left: to-rem($pxValue: 22);
padding-top: to-rem($pxValue: 8);
}
&[aria-haspopup="true"] {
position: relative;
}
}
@media screen and (min-width: 1024px) {
// Do not show Icon for menu on bigger screens
&[aria-haspopup="true"] {
&::after {
content: none;
}
}
.elm-link {
&:hover,
&:focus {
background-color: $db-color-cool-gray-200;
color: initial;
}
&[aria-current="page"] {
font-weight: 700;
}
}
}
}
}