This repository has been archived by the owner on Feb 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 359
/
Copy path_site-main-navigation.scss
228 lines (180 loc) · 4.14 KB
/
_site-main-navigation.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
// Navigation
.main-navigation {
color: #{map-deep-get($config-header, "main-nav", "color", "text")};
// Menu wrapper
& > div {
display: none;
}
// Mobile menu toggle
#toggle-menu {
display: inline-block;
margin: 0;
}
// Checkbox hack
#toggle:checked ~ div:not(.woocommerce-menu-container) {
display: block;
}
#toggle:focus + #toggle-menu {
background-color: #{map-deep-get($config-header, "main-nav", "color", "link-hover")};
outline: inherit;
text-decoration: underline;
}
.dropdown-icon.close {
display: none;
}
#toggle:checked + #toggle-menu {
.open {
display: none;
}
.close {
display: inline;
}
}
@include media(mobile) {
& > div {
display: inline-block;
}
#toggle-menu {
display: none;
}
// Hide sub-sub-menus
& > div > ul > li > ul {
display: none;
}
}
// Menu list wrapper
& > div > ul {
display: flex;
flex-wrap: wrap;
list-style: none;
margin: 0;
max-width: none;
padding-left: 0;
position: relative;
ul {
padding-left: 0;
}
li {
display: block;
position: relative;
width: 100%;
z-index: 1;
&:hover,
&:focus-within {
cursor: pointer;
z-index: 99999;
}
&:focus-within a {
// outline: none;
}
@include media(mobile) {
display: inherit;
width: inherit;
/* Submenu display */
&:hover > ul,
&:focus-within > ul,
& ul:hover,
& ul:focus {
visibility: visible;
opacity: 1;
display: block;
}
}
}
& > li {
@include media(mobile) {
& > a {
@include crop-text(map-deep-get($config-header, "main-nav", "font", "line-height"));
}
&:first-of-type > a {
padding-left: 0;
}
&:last-of-type > a {
padding-right: 0;
}
}
}
/* Sub-menus Flyout */
& > li > .sub-menu {
margin: 0;
position: relative;
@include media(mobile) {
background: map-deep-get($config-global, "color", "background", "default");
box-shadow: map-deep-get($config-global, "elevation", "4dp");
left: 0;
top: 100%;
min-width: max-content;
opacity: 0;
position: absolute;
transition: all 0.5s ease;
visibility: hidden;
}
.sub-menu {
width: 100%;
}
}
}
// Menu Link
a {
color: #{map-deep-get($config-header, "main-nav", "color", "link")};
display: block;
@include font-family( map-deep-get($config-header, "main-nav", "font", "family" ) );
font-weight: #{map-deep-get($config-header, "main-nav", "font", "weight")};
padding: #{0.5 * map-deep-get($config-header, "main-nav", "link-padding")} 0;
@include media(mobile) {
padding: #{map-deep-get($config-header, "main-nav", "link-padding")};
}
&:link,
&:visited {
color: #{map-deep-get($config-header, "main-nav", "color", "link")};
}
&:hover {
color: #{map-deep-get($config-header, "main-nav", "color", "link-hover")};
}
}
// Sub-menu depth indicators
.sub-menu {
list-style: none;
margin-left: 0;
/* Reset the counter for each UL */
counter-reset: nested-list;
.menu-item a {
padding-top: #{0.5 * map-deep-get($config-header, "main-nav", "link-padding")};
padding-bottom: #{0.5 * map-deep-get($config-header, "main-nav", "link-padding")};
&::before {
/* Increment the dashes */
counter-increment: nested-list;
/* Insert dashes with spaces in between */
content: "– " counters(nested-list, "– ", empty);
}
}
}
// Show top-level sub-menu indicators above mobile-breakpoint-only
@include media(mobile) {
& > div > ul > .menu-item-has-children > a {
&::after {
content: "\00a0\25BC";
display: inline-block;
font-size: map-deep-get($config-global, "font", "size", "xs");
height: inherit;
width: inherit;
}
}
}
.hide-visually {
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
overflow: hidden;
}
}
// Prevent overruling the user defined font size value set inside Gutenberg
// for Full Site Editing's Menu Navigation block.
body:not(.fse-enabled) {
.main-navigation a {
font-size: #{map-deep-get($config-header, "main-nav", "font", "size")};
}
}