Skip to content

Commit 2d3a9f8

Browse files
authored
refactor: Fix header styling issues (#1292)
* refactor: Simplify i18n color change on drop down * refactor: Sidebar toggle should be below expanded header * fix: Stop nav links in header from wrapping * fix: Ensure header dropdown arrow is vertically centered * fix: Social items in header * fix: Specificity * fix: Dropdown arrow alignment in expanded header
1 parent adbe4d2 commit 2d3a9f8

4 files changed

Lines changed: 33 additions & 20 deletions

File tree

src/assets/icons.svg

Lines changed: 1 addition & 1 deletion
Loading

src/components/header/style.module.css

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
background: #38235c;
33
color: white;
44

5+
height: var(--banner-height);
6+
57
padding: 0.5rem;
68

79
a {
@@ -29,7 +31,7 @@
2931
.open & {
3032
justify-content: space-between;
3133
-webkit-overflow-scrolling: touch;
32-
height: var(--vh);
34+
height: calc(var(--vh) - var(--banner-height));
3335
}
3436
}
3537

@@ -94,11 +96,7 @@
9496
}
9597

9698
nav {
97-
position: relative;
98-
display: inline-block;
99-
font-size: 100%;
100-
user-select: none;
101-
-webkit-user-drag: none;
99+
display: flex;
102100

103101
@media (max-width: /* --header-mobile-breakpoint */ 50rem) {
104102
display: block;
@@ -185,6 +183,8 @@
185183

186184
& > a,
187185
& > button {
186+
display: flex;
187+
align-items: center;
188188
transition: all 0.3s;
189189

190190
&::after {
@@ -203,7 +203,7 @@
203203

204204
& > a,
205205
& > button {
206-
display: block;
206+
display: flex;
207207
}
208208
}
209209

@@ -255,12 +255,6 @@
255255
& > button {
256256
background: #fff;
257257
color: #555;
258-
z-index: 101;
259-
260-
svg {
261-
filter: invert(40%) sepia(0%) saturate(3773%) hue-rotate(315deg)
262-
brightness(73%) contrast(81%);
263-
}
264258
}
265259

266260
nav {
@@ -313,6 +307,8 @@
313307
justify-content: space-between;
314308
align-items: flex-start;
315309

310+
touch-action: none;
311+
316312
@media (min-width: /* --content-width */ 50rem) {
317313
justify-content: center;
318314
justify-content: flex-start;
@@ -327,21 +323,38 @@
327323
.translation {
328324
position: absolute;
329325
height: 2rem;
330-
top: calc(var(--vh) - 3rem); /* TODO: Why does bottom not work? */
331-
display: flex;
326+
display: none;
327+
bottom: calc(env(safe-area-inset-bottom) + 1rem);
332328
width: 100%;
333329
justify-content: space-between;
334330
align-items: center;
335331

332+
@media (max-width: /* --header-mobile-breakpoint */ 50rem) {
333+
padding-left: 26px;
334+
padding-right: 26px;
335+
}
336+
337+
.open & {
338+
display: flex;
339+
}
340+
336341
@media (min-width: /* --content-width */ 50rem) {
337-
top: initial;
342+
display: flex;
343+
bottom: initial;
338344
height: 100%;
339345
left: initial;
340346
position: relative;
341347
width: initial;
342348
}
343349
}
344350

351+
.translation {
352+
@media (max-width: /* --header-mobile-breakpoint */ 50rem) {
353+
/* Otherwise overlaps the social items in the dropdown header, blocking use */
354+
display: none !important;
355+
}
356+
}
357+
345358
.socialItem {
346359
padding: 0 0.5rem;
347360
}
@@ -399,7 +412,6 @@
399412
padding: 18px 23px 12px;
400413
line-height: var(--header-height);
401414
text-align: center;
402-
z-index: 100;
403415
opacity: 0.7;
404416
cursor: pointer;
405417
transition: opacity 250ms ease;

src/components/sidebar/style.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
color: #fff;
2222
fill: rgba(255, 255, 255, 0.6);
2323
cursor: pointer;
24-
z-index: 560;
24+
z-index: 460;
2525
transition: transform 0.3s;
2626

2727
&:after {

src/style/variables.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
:root {
22
--vh: 100vh;
3+
--banner-height: 2.5rem;
34
--header-height: 3.5rem;
45
--header-mobile-breakpoint: 50rem;
5-
--header-and-banner-height: calc(var(--header-height) + 2.5rem);
6+
--header-and-banner-height: calc(var(--header-height) + var(--banner-height));
67
--content-width: 50rem;
78
--sidebar-break: 900px;
89

0 commit comments

Comments
 (0)