Skip to content

Commit 11e93fa

Browse files
committed
Header: Sticky and add blur effect
1 parent 4e1a2f1 commit 11e93fa

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

assets/css/v2/style.css

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@ textarea:not([rows]) {
249249
--grid-gutter: var(--space-s-l, clamp(1rem, 0.4975rem + 2.5126vw, 2.25rem));
250250
--grid-columns: 12;
251251

252-
/* TODO: This aligns the logo in the header perfectly with the one in the sidebar, but
253-
this is not a safe way to do it, and likely to get out of sync */
254-
--header-height: 6rem;
252+
--header-height: 4rem;
255253

256254
--sidebar-width: 22rem;
257255
--sidebar-item-padding-lr: 0.75rem;
@@ -362,10 +360,6 @@ ol li:last-child {
362360
}
363361

364362
.breadcrumb-layout {
365-
position: sticky;
366-
top: 0;
367-
z-index: 3;
368-
369363
border-bottom: 1px solid oklch(var(--color-divider));
370364
align-items: center;
371365
padding: var(--space-xs) 0;
@@ -427,6 +421,13 @@ ol li:last-child {
427421
padding: 0 var(--space-s);
428422
border-bottom: 1px solid oklch(var(--color-divider));
429423

424+
background: rgba(255, 255, 255, 0.5);
425+
backdrop-filter: blur(20px);
426+
-webkit-backdrop-filter: blur(20px);
427+
position: sticky;
428+
top: 0;
429+
z-index: 1;
430+
430431
.header-container {
431432
display: flex;
432433
flex-direction: row;
@@ -445,11 +446,17 @@ ol li:last-child {
445446

446447
.header__product-selector {
447448
width: 10rem;
449+
background: rgba(0, 0, 0, 0);
450+
color: oklch(var(--color-foreground));
451+
text-decoration-color: oklch(var(--color-brand) / 0.3);
452+
& :hover {
453+
color: oklch(var(--color-brand));
454+
}
448455

449456
.product-selector__button {
450457
display: flex;
451458
align-items: center;
452-
background: oklch(var(--color-background));
459+
background: rgba(0, 0, 0, 0);
453460
border: none;
454461
width: 16rem;
455462
font-weight: 500;
@@ -567,7 +574,8 @@ ol li:last-child {
567574
top: 0;
568575
left: 0;
569576
width: var(--sidebar-width);
570-
height: 100vh;
577+
/* for sticky header, this needs to be calculated to avoid extra whitespace */
578+
height: calc(110vh - var(--header-height));
571579
border-right: 1px solid oklch(var(--color-divider));
572580
overflow: hidden;
573581
background: oklch(var(--color-background));

layouts/partials/header.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{{ define "header" }}
2-
<div class="header__sidebar__panel">
3-
<label for="sidebar-panel">
4-
{{ partial "lucide" (dict "context" . "icon" "panel-left-open") }}
5-
</label>
6-
</div>
72
<div class="header-container">
83

4+
<div class="header__logo-small">
5+
<a href="{{ .Site.BaseURL | relLangURL }}" alt="NGINX Docs Home">
6+
<img class="header__img" src="{{ "/images/icons/NGINX-product-icon.svg" | absURL }}" alt="NGINX Docs">
7+
</a>
8+
</div>
99
<div class="header__logo">
1010
<a href="{{ .Site.BaseURL | relLangURL }}" alt="NGINX Docs Home">
1111
<img class="header__img" src="{{ "/images/icons/NGINX-Docs-horiz-black-type.svg" | absURL }}" alt="NGINX Docs">
1212
</a>
1313
</div>
1414

15-
<div class="header__logo-small">
16-
<a href="{{ .Site.BaseURL | relLangURL }}" alt="NGINX Docs Home">
17-
<img class="header__img" src="{{ "/images/icons/NGINX-product-icon.svg" | absURL }}" alt="NGINX Docs">
18-
</a>
15+
<div class="header__sidebar__panel">
16+
<label for="sidebar-panel">
17+
{{ partial "lucide" (dict "context" . "icon" "panel-left-open") }}
18+
</label>
1919
</div>
2020

2121
<div class="header__product-selector">

0 commit comments

Comments
 (0)