1 | /*
|
---|
2 | Definitions for navigation elements.
|
---|
3 | */
|
---|
4 | // Different elements are styled based on the same set of rules.
|
---|
5 | $header-height: 3.1875rem !default; // Height of the header element.
|
---|
6 | $header-back-color: #f8f8f8 !default; // Background color for the header element.
|
---|
7 | $header-hover-back-color: #f0f0f0 !default; // Background color for the header element (hover).
|
---|
8 | $header-fore-color: #444 !default; // Text color for the header element.
|
---|
9 | $header-border-color: #ddd !default; // Border color for the header element.
|
---|
10 | $nav-back-color: #f8f8f8 !default; // Background color for the nav element.
|
---|
11 | $nav-hover-back-color: #f0f0f0 !default; // Background color for the nav element (hover).
|
---|
12 | $nav-fore-color: #444 !default; // Text color for the nav element.
|
---|
13 | $nav-border-color: #ddd !default; // Border color for the nav element.
|
---|
14 | $nav-link-color: #0277bd !default; // Color for link in the nav element.
|
---|
15 | $footer-fore-color: #444 !default; // Text color for the footer element.
|
---|
16 | $footer-back-color: #f8f8f8 !default; // Background color for footer nav element.
|
---|
17 | $footer-border-color: #ddd !default; // Border color for the footer element.
|
---|
18 | $footer-link-color: #0277bd !default; // Color for link in the footer element.
|
---|
19 | $drawer-back-color: #f8f8f8 !default; // Background color for the drawer component.
|
---|
20 | $drawer-border-color: #ddd !default; // Border color for the drawer component.
|
---|
21 | $drawer-hover-back-color: #f0f0f0 !default; // Background color for the drawer component's close (hover).
|
---|
22 | $drawer-close-color: #444 !default; // Color of the close element for the drawer component.
|
---|
23 | $_header-only-bottom-border: true !default; // [Hidden] Apply styling only to the bottom border of header? (boolean)
|
---|
24 | $_header-links-uppercase: true !default; // [Hidden] Should header links and buttons be uppercase? (boolean)
|
---|
25 | $header-logo-name: 'logo' !default; // Class name for the header logo element.
|
---|
26 | $header-logo-font-size: 1.75rem !default; // Font ize for the header logo element.
|
---|
27 | $nav-sublink-prefix: 'sublink' !default; // Prefix for the subcategory tabs in nav.
|
---|
28 | $nav-sublink-depth: 2 !default; // Amount of subcategory classes to add.
|
---|
29 | $_footer-only-top-border: true !default; // [Hidden] Apply styling only to the top border of footer? (boolean)
|
---|
30 | $footer-font-size: 0.875rem !default; // Font size for text in footer element.
|
---|
31 | $sticky-name: 'sticky' !default; // Class name for sticky headers and footers.
|
---|
32 | $drawer-name: 'drawer' !default; // Class name for the drawer component.
|
---|
33 | $drawer-toggle-name: 'drawer-toggle' !default; // Class name for the drawer component's toggle.
|
---|
34 | $drawer-toggle-font-size: 1.5em !default; // Font size for the drawer component's toggle. (prefer em units)
|
---|
35 | $drawer-mobile-breakpoint: 768px !default; // Mobile breakpoint for the drawer component.
|
---|
36 | $_drawer-right: true !default; // [Hidden] Should the drawer appear on the right side of the screen?
|
---|
37 | $drawer-persistent-name: 'persistent' !default; // Class name for the persisten variant of the drawer component.
|
---|
38 | $drawer-width: 320px !default; // Width of the drawer component.
|
---|
39 | $drawer-close-name: 'drawer-close' !default; // Class name of the close element for the drawer component.
|
---|
40 | $drawer-close-size: 2rem !default; // Size of the close element for the drawer component.
|
---|
41 | // CSS variable name definitions [exercise caution if modifying these]
|
---|
42 | $header-fore-color-var: '--header-fore-color' !default;
|
---|
43 | $header-back-color-var: '--header-back-color' !default;
|
---|
44 | $header-hover-back-color-var: '--header-hover-back-color' !default;
|
---|
45 | $header-border-color-var: '--header-border-color' !default;
|
---|
46 | $nav-fore-color-var: '--nav-fore-color' !default;
|
---|
47 | $nav-back-color-var: '--nav-back-color' !default;
|
---|
48 | $nav-hover-back-color-var: '--nav-hover-back-color' !default;
|
---|
49 | $nav-border-color-var: '--nav-border-color' !default;
|
---|
50 | $nav-link-color-var: '--nav-link-color' !default;
|
---|
51 | $footer-fore-color-var: '--footer-fore-color' !default;
|
---|
52 | $footer-back-color-var: '--footer-back-color' !default;
|
---|
53 | $footer-border-color-var: '--footer-border-color' !default;
|
---|
54 | $footer-link-color-var: '--footer-link-color' !default;
|
---|
55 | $drawer-back-color-var: '--drawer-back-color' !default;
|
---|
56 | $drawer-border-color-var: '--drawer-border-color' !default;
|
---|
57 | $drawer-hover-back-color-var: '--drawer-hover-back-color' !default;
|
---|
58 | $drawer-close-color-var: '--drawer-close-color' !default;
|
---|
59 | // == Uncomment below code if this module is used on its own ==
|
---|
60 | //
|
---|
61 | // $universal-margin: 0.5rem !default; // Universal margin for the most elements
|
---|
62 | // $universal-padding: 0.5rem !default; // Universal padding for the most elements
|
---|
63 | // $universal-border-radius: 0.125rem !default; // Universal border-radius for most elements
|
---|
64 | // $universal-box-shadow: none !default; // Universal box-shadow for most elements
|
---|
65 | // $universal-margin-var: '--universal-margin' !default;
|
---|
66 | // $universal-padding-var: '--universal-padding' !default;
|
---|
67 | // $universal-border-radius-var: '--universal-border-radius' !default;
|
---|
68 | // $universal-box-shadow-var: '--universal-box-shadow' !default;
|
---|
69 | // :root {
|
---|
70 | // #{$universal-margin-var}: $universal-margin;
|
---|
71 | // #{$universal-padding-var}: $universal-padding;
|
---|
72 | // #{$universal-border-radius-var}: $universal-border-radius;
|
---|
73 | // @if $universal-box-shadow != none {
|
---|
74 | // #{$universal-box-shadow-var}: $universal-box-shadow;
|
---|
75 | // }
|
---|
76 | // }
|
---|
77 | //
|
---|
78 | // ============================================================
|
---|
79 | /* Navigation module CSS variable definitions */
|
---|
80 | :root {
|
---|
81 | #{$header-back-color-var}: $header-back-color;
|
---|
82 | #{$header-hover-back-color-var}: $header-hover-back-color;
|
---|
83 | #{$header-fore-color-var}: $header-fore-color;
|
---|
84 | #{$header-border-color-var}: $header-border-color;
|
---|
85 | #{$nav-back-color-var}: $nav-back-color;
|
---|
86 | #{$nav-hover-back-color-var}: $nav-hover-back-color;
|
---|
87 | #{$nav-fore-color-var}: $nav-fore-color;
|
---|
88 | #{$nav-border-color-var}: $nav-border-color;
|
---|
89 | #{$nav-link-color-var}: $nav-link-color;
|
---|
90 | #{$footer-fore-color-var}: $footer-fore-color;
|
---|
91 | #{$footer-back-color-var}: $footer-back-color;
|
---|
92 | #{$footer-border-color-var}: $footer-border-color;
|
---|
93 | #{$footer-link-color-var}: $footer-link-color;
|
---|
94 | #{$drawer-back-color-var}: $drawer-back-color;
|
---|
95 | #{$drawer-hover-back-color-var}: $drawer-hover-back-color;
|
---|
96 | #{$drawer-border-color-var}: $drawer-border-color;
|
---|
97 | #{$drawer-close-color-var}: $drawer-close-color;
|
---|
98 | }
|
---|
99 | // Header styling. - No box-shadow as it causes lots of weird bugs in Chrome. No margin as it shouldn't have any.
|
---|
100 | header {
|
---|
101 | height: $header-height;
|
---|
102 | background: var(#{$header-back-color-var}); // Always apply background color to avoid shine through
|
---|
103 | color: var(#{$header-fore-color-var});
|
---|
104 | @if $_header-only-bottom-border {
|
---|
105 | border-bottom: $__1px solid var(#{$header-border-color-var});
|
---|
106 | }
|
---|
107 | @else {
|
---|
108 | border: $__1px solid var(#{$header-border-color-var});
|
---|
109 | }
|
---|
110 | padding: calc(var(#{$universal-padding-var}) / 4) 0;
|
---|
111 | // Responsiveness for smaller displays, scrolls horizontally.
|
---|
112 | white-space: nowrap;
|
---|
113 | overflow-x: auto;
|
---|
114 | overflow-y: hidden;
|
---|
115 | // Fix for responsive header, using the grid system's row and column alignment.
|
---|
116 | &.#{$grid-row-name} {
|
---|
117 | box-sizing: content-box;
|
---|
118 | }
|
---|
119 | // Header logo styling.
|
---|
120 | .#{$header-logo-name} {
|
---|
121 | color: var(#{$header-fore-color-var});
|
---|
122 | font-size: $header-logo-font-size;
|
---|
123 | padding: var(#{$universal-padding-var}) calc(2 * var(#{$universal-padding-var}));
|
---|
124 | text-decoration: none;
|
---|
125 | }
|
---|
126 | // Link styling.
|
---|
127 | button, [type="button"], .#{$button-class-name}, [role="button"] {
|
---|
128 | box-sizing: border-box;
|
---|
129 | position: relative;
|
---|
130 | top: calc(0rem - var(#{$universal-padding-var}) / 4); // Use universal-padding to offset the padding of the header.
|
---|
131 | height: calc(#{$header-height} + var(#{$universal-padding-var}) / 2); // Fill header.
|
---|
132 | background: var(#{$header-back-color-var}); // Apply color regardless to override styling from other things.
|
---|
133 | line-height: calc(#{$header-height} - var(#{$universal-padding-var}) * 1.5);
|
---|
134 | text-align: center;
|
---|
135 | color: var(#{$header-fore-color-var});
|
---|
136 | border: 0;
|
---|
137 | border-radius: 0;
|
---|
138 | margin: 0;
|
---|
139 | @if $_header-links-uppercase {
|
---|
140 | text-transform: uppercase;
|
---|
141 | }
|
---|
142 | &:hover, &:focus {
|
---|
143 | background: var(#{$header-hover-back-color-var});
|
---|
144 | }
|
---|
145 | }
|
---|
146 | }
|
---|
147 | // Navigation sidebar styling.
|
---|
148 | nav {
|
---|
149 | background: var(#{$nav-back-color-var});
|
---|
150 | color: var(#{$nav-fore-color-var});
|
---|
151 | border: $__1px solid var(#{$nav-border-color-var});
|
---|
152 | border-radius: var(#{$universal-border-radius-var});
|
---|
153 | margin: var(#{$universal-margin-var});
|
---|
154 | @if $universal-box-shadow != none {
|
---|
155 | box-shadow: var(#{$universal-box-shadow-var});
|
---|
156 | }
|
---|
157 | * {
|
---|
158 | padding: var(#{$universal-padding-var}) calc(1.5 * var(#{$universal-padding-var}));
|
---|
159 | }
|
---|
160 | a, a:visited {
|
---|
161 | display: block;
|
---|
162 | color: var(#{$nav-link-color-var}); // Apply regardless to de-stylize visited links.
|
---|
163 | border-radius: var(#{$universal-border-radius-var});
|
---|
164 | transition: background 0.3s;
|
---|
165 | &:hover, &:focus {
|
---|
166 | text-decoration: none;
|
---|
167 | background: var(#{$nav-hover-back-color-var});
|
---|
168 | }
|
---|
169 | }
|
---|
170 | // Subcategories in navigation.
|
---|
171 | @for $i from 1 through $nav-sublink-depth {
|
---|
172 | .#{$nav-sublink-prefix}-#{$i} {
|
---|
173 | position: relative;
|
---|
174 | margin-left: calc(#{$i * 2} * var(#{$universal-padding-var}));
|
---|
175 | &:before {
|
---|
176 | position: absolute;
|
---|
177 | left: calc(var(#{$universal-padding-var}) - #{1 + ($i - 1)*2} * var(#{$universal-padding-var}));
|
---|
178 | top: -#{$__1px};
|
---|
179 | content: '';
|
---|
180 | height: 100%;
|
---|
181 | border: $__1px solid var(#{$nav-border-color-var});
|
---|
182 | border-left: 0;
|
---|
183 | }
|
---|
184 | }
|
---|
185 | }
|
---|
186 | }
|
---|
187 | // Footer styling.
|
---|
188 | footer {
|
---|
189 | background: var(#{$footer-back-color-var}); // Always apply background color to avoid shine through
|
---|
190 | color: var(#{$footer-fore-color-var});
|
---|
191 | @if $_footer-only-top-border {
|
---|
192 | border-top: $__1px solid var(#{$footer-border-color-var});
|
---|
193 | }
|
---|
194 | @else {
|
---|
195 | border: $__1px solid var(#{$footer-border-color-var});
|
---|
196 | }
|
---|
197 | // margin: $footer-margin;
|
---|
198 | padding: calc(2 * var(#{$universal-padding-var})) var(#{$universal-padding-var});
|
---|
199 | font-size: $footer-font-size;
|
---|
200 | a, a:visited {
|
---|
201 | color: var(#{$footer-link-color-var});
|
---|
202 | }
|
---|
203 | }
|
---|
204 | // Definitions for sticky headers and footers.
|
---|
205 | header.#{$sticky-name} {
|
---|
206 | position: -webkit-sticky; // One of the rare instances where prefixes are necessary.
|
---|
207 | position: sticky;
|
---|
208 | z-index: 1101; // Deals with certain problems when combined with cards and tables.
|
---|
209 | top: 0;
|
---|
210 | }
|
---|
211 | footer.#{$sticky-name} {
|
---|
212 | position: -webkit-sticky; // One of the rare instances where prefixes are necessary.
|
---|
213 | position: sticky;
|
---|
214 | z-index: 1101; // Deals with certain problems when combined with cards and tables.
|
---|
215 | bottom: 0;
|
---|
216 | }
|
---|
217 | // Responsive drawer component.
|
---|
218 | .#{$drawer-toggle-name} {
|
---|
219 | &:before { // No color specified, should use the color of its surroundings!
|
---|
220 | display: inline-block;
|
---|
221 | position: relative;
|
---|
222 | vertical-align: bottom;
|
---|
223 | content: '\00a0\2261\00a0'; // Spaces ensure compatibility with buttons that have text and that textless buttons will have some extra padding.
|
---|
224 | font-family: sans-serif;
|
---|
225 | font-size: $drawer-toggle-font-size; // Almost hardcoded, should be fully compatible with its surroundings.
|
---|
226 | }
|
---|
227 | @media screen and (min-width: #{$drawer-mobile-breakpoint}){
|
---|
228 | &:not(.#{$drawer-persistent-name}) {
|
---|
229 | display: none;
|
---|
230 | }
|
---|
231 | }
|
---|
232 | }
|
---|
233 | [type="checkbox"].#{$drawer-name} {
|
---|
234 | height: 1px;
|
---|
235 | width: 1px;
|
---|
236 | margin: -1px;
|
---|
237 | overflow: hidden;
|
---|
238 | position: absolute;
|
---|
239 | clip: rect(0 0 0 0);
|
---|
240 | -webkit-clip-path: inset(100%);
|
---|
241 | clip-path: inset(100%);
|
---|
242 | + * {
|
---|
243 | display: block;
|
---|
244 | box-sizing: border-box;
|
---|
245 | position: fixed;
|
---|
246 | top: 0;
|
---|
247 | width: $drawer-width;
|
---|
248 | height: 100vh;
|
---|
249 | overflow-y: auto;
|
---|
250 | background: var(#{$drawer-back-color-var});
|
---|
251 | border: $__1px solid var(#{$drawer-border-color-var});
|
---|
252 | border-radius: 0; // Set to 0 to override the value from `nav`.
|
---|
253 | margin: 0; // Set to 0 to override the value from `nav`.
|
---|
254 | @if $universal-box-shadow != none {
|
---|
255 | box-shadow: var(#{$universal-box-shadow-var});
|
---|
256 | }
|
---|
257 | z-index: 1110;
|
---|
258 | @if $_drawer-right {
|
---|
259 | right: -$drawer-width;
|
---|
260 | transition: right 0.3s;
|
---|
261 | }
|
---|
262 | @else {
|
---|
263 | left: -$drawer-width;
|
---|
264 | transition: left 0.3s;
|
---|
265 | }
|
---|
266 | & .#{$drawer-close-name} {
|
---|
267 | position: absolute;
|
---|
268 | top: var(#{$universal-margin-var});
|
---|
269 | right: var(#{$universal-margin-var});
|
---|
270 | z-index: 1111;
|
---|
271 | width: $drawer-close-size;
|
---|
272 | height: $drawer-close-size;
|
---|
273 | border-radius: var(#{$universal-border-radius-var});
|
---|
274 | padding: var(#{$universal-padding-var});
|
---|
275 | margin: 0; // Fixes the offset from label
|
---|
276 | cursor: pointer;
|
---|
277 | transition: background 0.3s;
|
---|
278 | &:before { // Transparent background unless hovered over. Does not block text behind it.
|
---|
279 | display: block;
|
---|
280 | content: '\00D7';
|
---|
281 | color: var(#{$drawer-close-color-var});
|
---|
282 | position: relative;
|
---|
283 | font-family: sans-serif;
|
---|
284 | font-size: $drawer-close-size;
|
---|
285 | line-height: 1; // Setting to 1 seems to center the 'X' properly.
|
---|
286 | text-align: center;
|
---|
287 | }
|
---|
288 | &:hover, &:focus {
|
---|
289 | background: var(#{$drawer-hover-back-color-var});
|
---|
290 | }
|
---|
291 | }
|
---|
292 | @media screen and (max-width: #{$drawer-width}) {
|
---|
293 | width: 100%;
|
---|
294 | }
|
---|
295 | }
|
---|
296 | &:checked + * {
|
---|
297 | @if $_drawer-right {
|
---|
298 | right: 0;
|
---|
299 | }
|
---|
300 | @else {
|
---|
301 | left: 0;
|
---|
302 | }
|
---|
303 | }
|
---|
304 | @media screen and (min-width: #{$drawer-mobile-breakpoint}){
|
---|
305 | &:not(.#{$drawer-persistent-name}) + * {
|
---|
306 | position: static;
|
---|
307 | height: 100%;
|
---|
308 | z-index: 1100;
|
---|
309 | & .#{$drawer-close-name} {
|
---|
310 | display: none;
|
---|
311 | }
|
---|
312 | }
|
---|
313 | }
|
---|
314 | }
|
---|