From fefd62fbea7072a5859f3bdd81e84734e4856e5b Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Mon, 30 Jun 2025 11:02:16 +0100 Subject: [PATCH 01/11] Headers: Add border to breadcrumb for mobile --- assets/css/v2/style.css | 77 ++++++++++++++++++++++++++---------- layouts/partials/header.html | 8 +++- 2 files changed, 62 insertions(+), 23 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index df120970..e48dabc8 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -251,10 +251,11 @@ textarea:not([rows]) { /* TODO: This aligns the logo in the header perfectly with the one in the sidebar, but this is not a safe way to do it, and likely to get out of sync */ - --header-height: 93px; + --header-height: 6rem; --sidebar-width: 22rem; - --sidebar-item-padding: 0.25rem 0.75rem; + --sidebar-item-padding-lr: 0.75rem; + --sidebar-item-padding-tb: 0.25rem; --content-max-width: 88rem; --main-col: minmax(34rem, 50rem); @@ -352,14 +353,35 @@ ol li:last-child { @media (max-width: 68rem) { grid-template-columns: 1fr; grid-template-areas: - "header" - "content" - "footer"; + "sidebar header" + "sidebar content" + "sidebar footer"; + + .text-content { + margin-top: 1rem; + } + + .content-layout .breadcrumb-layout { + position: sticky; + top: 0; + z-index: 3; + + border-bottom: 1px solid oklch(var(--color-divider)); + align-items: center; + padding: var(--space-xs) 0; + } + } + .content { + padding: 0 var(--space-s) 2rem; } .header__logo { display: none; } + + .header__logo-small { + display: none; + } } /* Homepage specific layout */ @@ -404,6 +426,7 @@ ol li:last-child { grid-area: header; display: flex; padding: 0 var(--space-s); + border-bottom: 1px solid oklch(var(--color-divider)); .header-container { display: flex; @@ -515,19 +538,21 @@ ol li:last-child { background: oklch(var(--color-background)); box-sizing: border-box; transform: translateX(0); - padding: var(--space-s) 0 var(--space-s) var(--space-s); + padding: 0 0 var(--space-s) var(--space-s); .sidebar__container { display: grid; - grid-template-rows: auto 1fr; + grid-template-rows: var(--header-height) 1fr; height: 100%; .sidebar__header { + display: flex; + align-items: center; position: sticky; top: 0; background: oklch(var(--color-background)); z-index: 1; - padding: var(--sidebar-item-padding); + padding: 0 0 0 var(--sidebar-item-padding-lr); .sidebar__img { height: 2rem; @@ -545,6 +570,19 @@ ol li:last-child { } @media (max-width: 68rem) { + .header { + .header__logo-small { + display: unset; + img { + margin: 0; + } + } + } + + .header__product-selector { + display: none; + } + .sidebar { grid-area: sidebar; position: absolute; @@ -760,13 +798,11 @@ nav { width: 100%; } -@media (max-width: 88rem) { - .content-layout .breadcrumb-layout { - position: sticky; - top: 0; - z-index: 3; - } +main { + margin: 0 var(--space-s) var(--space-s) var(--space-s); +} +@media (max-width: 88rem) { body:has(.sidebar__mobile-open) { /* Disable scrolling in main content + hide footer if the sidebar is visible */ overflow-y: hidden; @@ -840,13 +876,13 @@ nav { } } } - - main { - margin: 0 2rem 2rem 2rem; - } } @media (min-width: 88em) { + .header__logo { + display: unset; + } + .text-content { grid-template-columns: var(--grid-content) var(--grid-side-callout); grid-template-rows: 3rem max-content; @@ -1097,7 +1133,7 @@ nav.sidebar.sidebar__mobile-open { } .sidebar__container button { - padding: var(--sidebar-item-padding); + padding: var(--sidebar-item-padding-tb) var(--sidebar-item-padding-lr); justify-content: space-between; } @@ -1159,7 +1195,7 @@ nav.sidebar.sidebar__mobile-open { .sidebar__link { display: block; - padding: var(--sidebar-item-padding); + padding: var(--sidebar-item-padding-tb) var(--sidebar-item-padding-lr); margin: 2px 0 2px 0; border-radius: 5px 0 0 5px; color: oklch(0 0 0 / 0.75); @@ -1904,7 +1940,6 @@ figure { img, .figure-bitmap { - margin-bottom: 0.625rem; display: inline-block; width: auto; max-width: 100%; diff --git a/layouts/partials/header.html b/layouts/partials/header.html index efb40115..9966ebc3 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -7,6 +7,12 @@ +
+ + NGINX Docs + +
+
{{ $nginxProducts := slice (dict "title" "NGINX One Console" "url" "/nginx-one" "type" "nginx-one") @@ -64,8 +70,6 @@
{{ end }} - - {{ if ( not ( in .Site.Params.buildtype "package" ) ) }} From c852b71956b33a8cc576a932581136018e0367cd Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Mon, 30 Jun 2025 11:10:58 +0100 Subject: [PATCH 02/11] Headers: Set spacing to around --- assets/css/v2/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index e48dabc8..3dbc786b 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -361,7 +361,7 @@ ol li:last-child { margin-top: 1rem; } - .content-layout .breadcrumb-layout { + .breadcrumb-layout { position: sticky; top: 0; z-index: 3; @@ -431,7 +431,7 @@ ol li:last-child { .header-container { display: flex; flex-direction: row; - justify-content: space-between; + justify-content: space-around; align-items: center; width: 100%; From 4e1a2f160276ed886893bd675211f38b52ed40fe Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Mon, 30 Jun 2025 14:35:01 +0100 Subject: [PATCH 03/11] Sidebar: Add initial collapsible sidebar --- assets/css/v2/style.css | 145 +++++++++++++------------------ layouts/_default/baseof.html | 1 + layouts/partials/header.html | 5 ++ layouts/partials/sidebar-v2.html | 13 ++- 4 files changed, 75 insertions(+), 89 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index 3dbc786b..3b322f03 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -392,15 +392,14 @@ ol li:last-child { "content" "footer"; - .sidebar { - display: none; - } - .header__logo { display: unset; } - .header__product-selector { + .sidebar, + .header__product-selector, + .header__sidebar__panel, + .header__logo-small { display: none; } } @@ -525,7 +524,43 @@ ol li:last-child { margin-top: auto; } +/* sidebar toggling */ +#sidebar-panel:checked ~ .grid-container { + grid-template-columns: 1fr; + grid-template-areas: + "header" + "content" + "footer"; + + .sidebar { + display: none; + } + + .header__sidebar__panel { + display: flex; + align-self: center; + } +} + /* sidebar layout */ + +.header__sidebar__panel, +.sidebar__panel { + cursor: pointer; + color: var(--color-foreground); + label { + cursor: pointer; + } + + :hover { + color: oklch(var(--color-brand)); + } +} + +.header__sidebar__panel { + display: none; +} + .sidebar { grid-area: sidebar; position: fixed; @@ -548,11 +583,12 @@ ol li:last-child { .sidebar__header { display: flex; align-items: center; + justify-content: space-between; position: sticky; top: 0; background: oklch(var(--color-background)); z-index: 1; - padding: 0 0 0 var(--sidebar-item-padding-lr); + padding: 0 2.25rem 0 var(--sidebar-item-padding-lr); .sidebar__img { height: 2rem; @@ -569,7 +605,19 @@ ol li:last-child { } } +/* This is our "mobile" or no sidebar breakpoint */ @media (max-width: 68rem) { + #sidebar-panel:checked ~ .grid-container { + .sidebar { + /* Above search */ + z-index: 11; + display: unset; + transform: translateX(0); + border-bottom: 1px solid oklch(var(--color-divider)); + height: fit-content; + } + } + .header { .header__logo-small { display: unset; @@ -583,6 +631,11 @@ ol li:last-child { display: none; } + .header__sidebar__panel { + display: flex; + align-items: center; + } + .sidebar { grid-area: sidebar; position: absolute; @@ -593,10 +646,6 @@ ol li:last-child { transform: translateX(-100%); } - #sidebar-toggle:checked ~ .sidebar { - transform: translateX(0); - } - .sidebar-button { display: block; margin-bottom: 1rem; @@ -802,82 +851,6 @@ main { margin: 0 var(--space-s) var(--space-s) var(--space-s); } -@media (max-width: 88rem) { - body:has(.sidebar__mobile-open) { - /* Disable scrolling in main content + hide footer if the sidebar is visible */ - overflow-y: hidden; - - .sidebar-layout { - position: absolute; - height: 100%; - } - - footer { - display: none; - } - - .sidebar-layout .sidebar__mobile__toggle { - display: flex; - align-items: center; - position: sticky; - top: 1rem; - margin-top: 2rem; - margin-left: 2rem; - margin-right: 2rem; - padding: 0.5rem; - color: white; - background-color: oklch(var(--color-brand)); - } - } - - .sidebar__mobile__toggle { - background-color: transparent; - border: none; - - .lucide { - margin-right: 1rem; - } - } - - .main-layout { - /* Mobile support for sidebar */ - display: flex; - flex-direction: column; - position: relative; - - .sidebar-layout { - min-height: fit-content; - background: white; - z-index: 999; - width: calc(100% + 4rem); - margin-left: -2rem; - - &::before { - display: none; - } - - nav { - width: 100%; - display: none; - top: var(--sidebar-mobile-top-displacement); - max-height: calc(100vh - var(--sidebar-mobile-top-displacement)); - padding: 0 2rem; - - .sidebar__container { - width: 100%; - } - } - } - - .content-layout { - .breadcrumb-layout .sidebar__mobile__toggle { - display: inline; - padding: 0; - } - } - } -} - @media (min-width: 88em) { .header__logo { display: unset; diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index e00ee014..4046f384 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -41,6 +41,7 @@ {{ if or ( not hugo.IsServer ) ( not ( in .Site.Params.buildtype "package" ) ) }} {{ partial "universal-tag.html" . }} {{ end }} +