Newer
Older
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
/*
* Convenience mixin for the header only.
* to generate the animation transitions and have one source from where to set
* duration and mode.
*/
@mixin header-animate($property) {
transition: $property 0.25s linear;
}
/*
Following is the default setup for the header.
Specific settings for smaller screens can be found below the
default section.
*/
.header {
@include width-full-viewport;
@include drop-shadow(
$color: rgba($color-helmholtz-blue, 0.25)
);
position: fixed;
background: transparent;
z-index: 1000;
@include respond-to-medium(
min-height, $header-min-height
);
#header-content-container {
display: flex;
justify-content: space-between;
align-items: center;
background: white;
@include respond-to-medium(
min-height, $header-content-min-height
);
/*
Use padding to enforce the distance between borders and content.
Since Margins would not receive a background color.
*/
padding-top: $document-top-margin;
padding-bottom: $document-top-margin;
padding-left: $document-side-margin;
padding-right: $document-side-margin;
@include header-animate(padding);
}
.logo-link {
/*
* The logo is allowed to overlap the bottom content container padding
* since there also is the transition below for padding.
*/
margin-bottom: -$document-top-margin;
@include header-animate(transform);
.logo{
padding: 0.5rem;
@include header-animate(padding);
}
}
/*
IMPORTANT:
Do not shuffle the .nav_toggle blocks around unless you know what you
are doing. Potential results may include breaking the drop-down menu on
mobile devices and loss of sanity.
*/
.nav_toggle {
/* Not displayed by default, only on smaller screens */
display: none;
}
/* Navigation on the right side */
nav {
@include font-bold;
@include text-uppercase;
display: inline-flex;
justify-content: flex-end;
/* Extend to at most half the screen if more is available */
flex-grow: 0.5;
color: $color-helmholtz-blue;
.btn-header {
@include font-bold;
color: $color-helmholtz-blue;
background-color: white;
border: none;
&:hover {
background-color: $color-content-light-gray;
}
&:focus {
box-shadow: 0 0 0 0.2rem rgba($color-content-light-gray,0.5);
}
}
/* Navigation items have both an icon and a title. */
.navigation-entry {
display: inline-block;
@include header-animate(font-size);
.navigation-icon {
display: inline-block;
margin-right: 0.25rem;
}
}
}
/* The transition element at the end of the header */
.transition {
color: white;
margin-top: -1px;
}
}
/* On desktops and larger screens the header shrinking actually has an effect.
* No header shrinking on mobile and below, otherwise it can not be reliably
* interacted with anymore.
*/
@include medium-is-desktop-plus {
.header.shrink {
#header-content-container {
padding-top: calc(#{$document-top-margin} / 4);
padding-bottom: calc(#{$document-top-margin} / 4);
.btn-header {
padding-top: 0.25rem;
padding-bottom: 0.25rem;
/* If hovering over the button, show the text again */
&:hover,
&:focus {
.navigation-text {
width: auto;
}
}
}
.logo-link {
/*
* CSS transformations are the best way to size down the logo.
* The translation keeps it close to the left border, otherwise
* it would be scaled areound the center.
*/
transform: translate(-25%, 0%) scale(0.5);
.logo{
padding-top: 0.25rem;
padding-bottom: 0.25rem;
min-height: 1rem;
}
}
.navigation-entry {
font-size: 0.75rem;
}
}
}
}
@include medium-is-tablet {
.header {
nav {
/* Navigation items have an icon and no title. */
.navigation-entry {
display: block;
@include font-extra-small;
.navigation-icon {
width: 100%;
display: block;
@include font-normal;
}
}
/* Reduce Pre-defined button padding on tablets */
.btn-header {
padding-left: 0.25rem;
padding-right: 0.25rem;
flex-grow: 1;
}
}
}
}
@include medium-is-tablet-minus {
.header{
.nav_toggle {
display: block;
height: 1.5rem;
width: 1.5rem;
border: none;
background-color: transparent;
outline: none;
padding: 0;
&:before {
content: "\f0c9";
font-family: "Font Awesome 5 Free";
font-size: 1.5rem;
font-weight: 900;
color: $color-helmholtz-blue;
}
}
/*
This SCSS part is used to mimic the behavior, previously implemented
via Javascript, in pure CSS using a technique called "Checkbox Hack"
https://css-tricks.com/the-checkbox-hack/. This works by connecting
a <label> with <input type="checkbox"> and hiding the <label>.
Clicking on the label toggles the :checked state of this ID and allows
for applying different style.
*/
#mobile_toggle:checked ~ .nav_toggle::before {
content: "\f00d";
color: $color-helmholtz-green;
}
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
#mobile_toggle:checked ~ nav {
display: flex;
flex-direction: column;
justify-content: flex-end;
align-content: center;
position: absolute;
left: $document-side-margin;
right: $document-side-margin;
top: 0;
font-size: 1rem;
color: white;
background-color: $color-helmholtz-green;
margin-left: auto;
margin-right: auto;
padding-top: 1.5rem; /* Determined by eyeballing */
padding-left: 0.5rem;
padding-right: 0.5rem;
padding-bottom: 0.5rem;
border-radius: 0.5em;
z-index: -1; /* Go below the header */
@include respond-to-medium(
margin-top, $header-min-height
);
a {
width: auto; /* Allow parent flexbox to determine */
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
}
}
/*
If on a small device, the navigation will not be displayed.
The toggle button for the fold menu is used instead
*/
nav {
display: none;
.btn-header {
@include font-bold;
color: white;
background-color: $color-helmholtz-green;
border: none;
margin: 0.25rem;
&:hover{
background-color: $color-helmholtz-dark-green;
}
&:focus {
box-shadow: 0 0 0 0.2rem rgba($color-helmholtz-dark-green,0.5);
}
}
/* Navigation items have a title and no icon. */
.navigation-entry {
display: inline-block;
.navigation-icon {
display: inline-block;
margin-right: 0.5rem;
}
}
}
}
}