Skip to content

Commit fefd62f

Browse files
committed
Headers: Add border to breadcrumb for mobile
1 parent bb0c31a commit fefd62f

File tree

2 files changed

+62
-23
lines changed

2 files changed

+62
-23
lines changed

assets/css/v2/style.css

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,11 @@ textarea:not([rows]) {
251251

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

256256
--sidebar-width: 22rem;
257-
--sidebar-item-padding: 0.25rem 0.75rem;
257+
--sidebar-item-padding-lr: 0.75rem;
258+
--sidebar-item-padding-tb: 0.25rem;
258259
--content-max-width: 88rem;
259260

260261
--main-col: minmax(34rem, 50rem);
@@ -352,14 +353,35 @@ ol li:last-child {
352353
@media (max-width: 68rem) {
353354
grid-template-columns: 1fr;
354355
grid-template-areas:
355-
"header"
356-
"content"
357-
"footer";
356+
"sidebar header"
357+
"sidebar content"
358+
"sidebar footer";
359+
360+
.text-content {
361+
margin-top: 1rem;
362+
}
363+
364+
.content-layout .breadcrumb-layout {
365+
position: sticky;
366+
top: 0;
367+
z-index: 3;
368+
369+
border-bottom: 1px solid oklch(var(--color-divider));
370+
align-items: center;
371+
padding: var(--space-xs) 0;
372+
}
373+
}
374+
.content {
375+
padding: 0 var(--space-s) 2rem;
358376
}
359377

360378
.header__logo {
361379
display: none;
362380
}
381+
382+
.header__logo-small {
383+
display: none;
384+
}
363385
}
364386

365387
/* Homepage specific layout */
@@ -404,6 +426,7 @@ ol li:last-child {
404426
grid-area: header;
405427
display: flex;
406428
padding: 0 var(--space-s);
429+
border-bottom: 1px solid oklch(var(--color-divider));
407430

408431
.header-container {
409432
display: flex;
@@ -515,19 +538,21 @@ ol li:last-child {
515538
background: oklch(var(--color-background));
516539
box-sizing: border-box;
517540
transform: translateX(0);
518-
padding: var(--space-s) 0 var(--space-s) var(--space-s);
541+
padding: 0 0 var(--space-s) var(--space-s);
519542

520543
.sidebar__container {
521544
display: grid;
522-
grid-template-rows: auto 1fr;
545+
grid-template-rows: var(--header-height) 1fr;
523546
height: 100%;
524547

525548
.sidebar__header {
549+
display: flex;
550+
align-items: center;
526551
position: sticky;
527552
top: 0;
528553
background: oklch(var(--color-background));
529554
z-index: 1;
530-
padding: var(--sidebar-item-padding);
555+
padding: 0 0 0 var(--sidebar-item-padding-lr);
531556

532557
.sidebar__img {
533558
height: 2rem;
@@ -545,6 +570,19 @@ ol li:last-child {
545570
}
546571

547572
@media (max-width: 68rem) {
573+
.header {
574+
.header__logo-small {
575+
display: unset;
576+
img {
577+
margin: 0;
578+
}
579+
}
580+
}
581+
582+
.header__product-selector {
583+
display: none;
584+
}
585+
548586
.sidebar {
549587
grid-area: sidebar;
550588
position: absolute;
@@ -760,13 +798,11 @@ nav {
760798
width: 100%;
761799
}
762800

763-
@media (max-width: 88rem) {
764-
.content-layout .breadcrumb-layout {
765-
position: sticky;
766-
top: 0;
767-
z-index: 3;
768-
}
801+
main {
802+
margin: 0 var(--space-s) var(--space-s) var(--space-s);
803+
}
769804

805+
@media (max-width: 88rem) {
770806
body:has(.sidebar__mobile-open) {
771807
/* Disable scrolling in main content + hide footer if the sidebar is visible */
772808
overflow-y: hidden;
@@ -840,13 +876,13 @@ nav {
840876
}
841877
}
842878
}
843-
844-
main {
845-
margin: 0 2rem 2rem 2rem;
846-
}
847879
}
848880

849881
@media (min-width: 88em) {
882+
.header__logo {
883+
display: unset;
884+
}
885+
850886
.text-content {
851887
grid-template-columns: var(--grid-content) var(--grid-side-callout);
852888
grid-template-rows: 3rem max-content;
@@ -1097,7 +1133,7 @@ nav.sidebar.sidebar__mobile-open {
10971133
}
10981134

10991135
.sidebar__container button {
1100-
padding: var(--sidebar-item-padding);
1136+
padding: var(--sidebar-item-padding-tb) var(--sidebar-item-padding-lr);
11011137
justify-content: space-between;
11021138
}
11031139

@@ -1159,7 +1195,7 @@ nav.sidebar.sidebar__mobile-open {
11591195

11601196
.sidebar__link {
11611197
display: block;
1162-
padding: var(--sidebar-item-padding);
1198+
padding: var(--sidebar-item-padding-tb) var(--sidebar-item-padding-lr);
11631199
margin: 2px 0 2px 0;
11641200
border-radius: 5px 0 0 5px;
11651201
color: oklch(0 0 0 / 0.75);
@@ -1904,7 +1940,6 @@ figure {
19041940

19051941
img,
19061942
.figure-bitmap {
1907-
margin-bottom: 0.625rem;
19081943
display: inline-block;
19091944
width: auto;
19101945
max-width: 100%;

layouts/partials/header.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
</a>
88
</div>
99

10+
<div class="header__logo-small">
11+
<a href="{{ .Site.BaseURL | relLangURL }}" alt="NGINX Docs Home">
12+
<img class="header__img" src="{{ "/images/icons/NGINX-product-icon.svg" | absURL }}" alt="NGINX Docs">
13+
</a>
14+
</div>
15+
1016
<div class="header__product-selector">
1117
{{ $nginxProducts := slice
1218
(dict "title" "NGINX One Console" "url" "/nginx-one" "type" "nginx-one")
@@ -64,8 +70,6 @@
6470
</div>
6571
{{ end }}
6672
</div>
67-
68-
6973
</div>
7074

7175
{{ if ( not ( in .Site.Params.buildtype "package" ) ) }}

0 commit comments

Comments
 (0)