From 3f08fa5b440b8c4c0ec6d436ad2877a5dbb04dc2 Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Fri, 20 Jun 2025 11:55:02 +0100 Subject: [PATCH 01/14] Grid: Restructure high-level DOM and Grid Simplifies overall high level DOM structure and uses new grid system. This is still work-in-progress. Sidebar, header and redocly page still require refactoring to look as expected. --- assets/css/v2/style.css | 343 +++++++++++++++++++++---------- layouts/_default/baseof.html | 19 +- layouts/_default/docs.html | 62 ------ layouts/_default/list.html | 108 +++++----- layouts/_default/single.html | 67 +++++- layouts/partials/header.html | 51 +---- layouts/partials/sidebar-v2.html | 1 + 7 files changed, 368 insertions(+), 283 deletions(-) delete mode 100644 layouts/_default/docs.html diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index f90ceea4..b9ff9d94 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -1,3 +1,95 @@ +/* MARK: Reset +*/ +/* Modern reset: https://piccalil.li/blog/a-more-modern-css-reset/ */ + +/* Box sizing rules */ +*, +*::before, +*::after { + box-sizing: border-box; +} + +/* Prevent font size inflation */ +html { + -moz-text-size-adjust: none; + -webkit-text-size-adjust: none; + text-size-adjust: none; + overflow-y: scroll; +} + +/* Remove default margin in favour of better control in authored CSS */ +body, +h1, +h2, +h3, +h4, +p, +figure, +blockquote, +dl, +dd { + margin-block-end: 0; +} + +/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */ +ul[role="list"], +ol[role="list"] { + list-style: none; +} + +/* Set core body defaults */ +body { + min-height: 100vh; + line-height: 1.5; + margin: 0; +} + +/* Set shorter line heights on headings and interactive elements */ +h1, +h2, +h3, +h4, +button, +input, +label { + line-height: 1.1; +} + +/* Balance text wrapping on headings */ +h1, +h2, +h3, +h4 { + text-wrap: balance; +} + +/* Make images easier to work with */ +img, +picture { + max-width: 100%; + display: block; +} + +/* Inherit fonts for inputs and buttons */ +input, +button, +textarea, +select { + font: inherit; +} + +/* Make sure textareas without a rows attribute are not tiny */ +textarea:not([rows]) { + min-height: 10em; +} + +/* Anything that has been anchored to should have extra scroll margin */ +:target { + scroll-margin-block: 5ex; +} + +/* END RESET */ + /* Regular */ @font-face { font-family: "JetBrainsMono"; @@ -92,7 +184,6 @@ --sidebar-line-box-side-length: 8px; --sidebar-line-box-top: 6px; --sidebar-line-box-left: 12px; - --sidebar-width: 22rem; --sidebar-line-width: 11.5px; --sidebar-mobile-top-displacement: 5rem; --side-gutter-width: 20rem; @@ -112,35 +203,54 @@ --overflow-gutter-extension: 1rem; --flow-gap: 1rem; -} -/* MARK: Reset -*/ -html, -body, -p, -ol, -ul, -li, -dl, -dt, -dd, -blockquote, -figure, -fieldset, -legend, -textarea, -pre, -iframe, -hr, -h1, -h2, -h3, -h4, -h5, -h6 { - margin: 0; - padding: 0; + /* @link https://utopia.fyi/type/calculator?c=320,16,1.2,1240,18,1.25,5,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */ + /* ALWAYS use for fonts */ + --font-step--3: clamp(0.576rem, 0.5796rem + -0.0047vw, 0.5787rem); + --font-step--2: clamp(0.6944rem, 0.6856rem + 0.0444vw, 0.72rem); + --font-step--1: clamp(0.8333rem, 0.8101rem + 0.1159vw, 0.9rem); + --font-step-0: clamp(1rem, 0.9565rem + 0.2174vw, 1.125rem); + --font-step-1: clamp(1.2rem, 1.1283rem + 0.3587vw, 1.4063rem); + --font-step-2: clamp(1.44rem, 1.3295rem + 0.5527vw, 1.7578rem); + --font-step-3: clamp(1.728rem, 1.5648rem + 0.8161vw, 2.1973rem); + --font-step-4: clamp(2.0736rem, 1.8395rem + 1.1704vw, 2.7466rem); + --font-step-5: clamp(2.4883rem, 2.1597rem + 1.6433vw, 3.4332rem); + + /* @link https://utopia.fyi/space/calculator?c=320,16,1.2,1240,18,1.25,5,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */ + /* ALWAYS use for horizontal spacing */ + --space-3xs: clamp(0.25rem, 0.2283rem + 0.1087vw, 0.3125rem); + --space-2xs: clamp(0.5rem, 0.4783rem + 0.1087vw, 0.5625rem); + --space-xs: clamp(0.75rem, 0.7065rem + 0.2174vw, 0.875rem); + --space-s: clamp(1rem, 0.9565rem + 0.2174vw, 1.125rem); + --space-m: clamp(1.5rem, 1.4348rem + 0.3261vw, 1.6875rem); + --space-l: clamp(2rem, 1.913rem + 0.4348vw, 2.25rem); + --space-xl: clamp(3rem, 2.8696rem + 0.6522vw, 3.375rem); + --space-2xl: clamp(4rem, 3.8261rem + 0.8696vw, 4.5rem); + --space-3xl: clamp(6rem, 5.7391rem + 1.3043vw, 6.75rem); + + /* One-up pairs */ + --space-3xs-2xs: clamp(0.25rem, 0.1413rem + 0.5435vw, 0.5625rem); + --space-2xs-xs: clamp(0.5rem, 0.3696rem + 0.6522vw, 0.875rem); + --space-xs-s: clamp(0.75rem, 0.6196rem + 0.6522vw, 1.125rem); + --space-s-m: clamp(1rem, 0.7609rem + 1.1957vw, 1.6875rem); + --space-m-l: clamp(1.5rem, 1.2391rem + 1.3043vw, 2.25rem); + --space-l-xl: clamp(2rem, 1.5217rem + 2.3913vw, 3.375rem); + --space-xl-2xl: clamp(3rem, 2.4783rem + 2.6087vw, 4.5rem); + --space-2xl-3xl: clamp(4rem, 3.0435rem + 4.7826vw, 6.75rem); + + /* Custom pairs */ + --space-s-l: clamp(1rem, 0.5652rem + 2.1739vw, 2.25rem); + + /* @link https://utopia.fyi/grid/calculator?c=320,16,1.2,1240,18,1.25,5,3,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */ + --grid-max-width: 69.75rem; + --grid-gutter: var(--space-s-l, clamp(1rem, 0.4975rem + 2.5126vw, 2.25rem)); + --grid-columns: 12; + + --sidebar-width: 22rem; + --content-max-width: 88rem; + + --main-col: minmax(34rem, 50rem); + --side-col: minmax(18rem, 26rem); } @supports (font-variation-settings: normal) { @@ -173,6 +283,9 @@ h6, html { scroll-behavior: smooth; + font-optical-sizing: auto; + font-weight: 300; + font-style: normal; } h1, @@ -215,8 +328,29 @@ ol li:last-child { /* MARK: Layout */ -header { - margin: 2rem 2rem 0 2rem; + +.grid-container { + display: grid; + grid-template-columns: var(--sidebar-width) 1fr; + grid-template-rows: var(--space-xl) 1fr auto; + grid-template-areas: + "sidebar header" + "sidebar content" + "sidebar footer"; + min-height: 100vh; + + @media (max-width: 68rem) { + grid-template-columns: 1fr; + grid-template-areas: + "header" + "content" + "footer"; + } +} + +.header { + grid-area: header; + display: flex; .header-container { display: flex; @@ -254,56 +388,89 @@ header { ul { list-style: none; } +} - .dropdown-content { - position: absolute; - background-color: oklch(var(--color-background)); - border: oklch(var(--color-foreground)) 1px solid; - box-shadow: 3px 3px 0px oklch(var(--color-shadow)); - z-index: 1; - right: 0; - display: none; - width: 400px; - max-width: 80vw; - margin-right: 2rem; - } +.content { + grid-area: content; + justify-self: center; + padding: var(--space-s); + max-width: var(--content-max-width); +} - .dropdown-content ul { - padding: 20px 10px; - } +.footer { + grid-area: footer; + padding: var(--space-l); + background-color: oklch(var(--color-footer)); + margin-top: auto; +} - .nav-item-explore { - margin: 0; +/* sidebar layout */ +.sidebar { + grid-area: sidebar; + position: fixed; + top: 0; + left: 0; + width: var(--sidebar-width); + height: 100vh; + /* TODO replace with correct color var */ + border-right: 1px solid oklch(var(--color-divider)); + overflow: hidden; + background: oklch(var(--color-background)); + box-sizing: border-box; + transform: translateX(0); + + .sidebar__container { + display: grid; + grid-template-rows: auto 1fr; + height: 100%; + + .sidebar__header { + position: sticky; + top: 0; + background: oklch(var(--color-background)); + z-index: 1; + + .sidebar__img { + height: 1.75rem; + } + } + + .sidebar__content { + overflow-y: auto; + min-height: 0; + width: 100%; + scrollbar-gutter: stable; + } } +} - .navbar-button { - padding: 0.5rem 0.5rem; - border: none; - border-radius: 0.25rem; - text-align: center; - text-decoration: none; - cursor: pointer; +@media (max-width: 68rem) { + .sidebar { + grid-area: sidebar; + position: absolute; + top: 0; + left: 0; + bottom: 0; + width: var(--sidebar-width, 16rem); + transform: translateX(-100%); } - .remove-bottom-radius { - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; + #sidebar-toggle:checked ~ .sidebar { + transform: translateX(0); } -} -main { - flex: 1; - min-width: 20rem; - margin: 0 2rem 2rem 1rem; + .sidebar-button { + display: block; + margin-bottom: 1rem; + padding: 0.5rem 1rem; + background: #000; + color: #fff; + cursor: pointer; + } } /* MARK: Footer */ -footer { - background-color: oklch(var(--color-footer)); - padding: 2.5rem; - margin-top: auto; -} .footer-layout { display: grid; @@ -498,12 +665,6 @@ nav { grid-column: 1 / -1; } -/* The default main-layout */ -.main-layout { - display: grid; - grid-template-columns: 1fr; -} - .sidebar-container { display: flex; flex-direction: column; @@ -643,12 +804,6 @@ nav { grid-column: 1; } - .main-layout { - display: grid; - grid-template-columns: var(--sidebar-width) 1fr; - column-gap: var(--grid-sidebar-gutter); - } - .content-layout { display: grid; grid-template-columns: 1fr minmax( @@ -673,7 +828,7 @@ nav { } .list-page { - --flow-gap: .5rem; + --flow-gap: 0.5rem; h2 { font-size: 1.5rem; @@ -695,11 +850,6 @@ nav { display: grid !important; } - .breadcrumb-layout { - width: auto; - margin-top: 2rem; - } - .nginx-docs-api-container { grid-column: 1 / -1; max-width: 100% !important; @@ -877,7 +1027,7 @@ button:has(~ .product-selector[style*="none"]) > .product-selector-button-icon { font-size: 1rem; } -/* MARK: Sidebar +/* MARK: Sidebar - Content */ nav.sidebar.sidebar__mobile-open { @@ -885,21 +1035,9 @@ nav.sidebar.sidebar__mobile-open { } .sidebar { + grid-area: sidebar; --color-foreground: oklch(0 0 0 / 0.75); - display: flex; - flex-direction: column; - width: 22rem; - max-height: 100vh; - position: sticky; - top: 0; - margin-top: 0rem; - padding-top: 1.5rem; - align-items: start; - overflow-y: auto; - overflow-x: hidden; - color: var(--color-foreground); - .sidebar__container, .sidebar__container button, .sidebar__container ul, @@ -1074,9 +1212,6 @@ p { .breadcrumb-layout { position: relative; background-color: white; - /* width: calc(100% + 4rem); */ - margin-left: -2rem; - padding: 1rem 2rem; .sidebar__mobile__toggle { display: none; @@ -1127,7 +1262,7 @@ h1 { h2 { font-size: 1.5rem; - margin: 1rem 0 .75rem 0; + margin: 1rem 0 0.75rem 0; } h2:target, diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index ba92f241..88d4dbbd 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -39,24 +39,11 @@ {{ if or ( not hugo.IsServer ) ( not ( in .Site.Params.buildtype "package" ) ) }} - {{ partial "universal-tag.html" . }} + {{ partial "universal-tag.html" . }} {{ end }} -
- {{ block "header" . }}{{end}} -
- -
-
- {{ block "main" . }}{{ end }} -
-
- - + {{ block "main" . }}{{ end }} + {{ partial "scripts.html" . }} diff --git a/layouts/_default/docs.html b/layouts/_default/docs.html deleted file mode 100644 index 3302ca55..00000000 --- a/layouts/_default/docs.html +++ /dev/null @@ -1,62 +0,0 @@ -{{ define "main" }} -
-
- - {{ $content := partial "icon-replacement.html" (dict "content" .Content) }} - - {{if (.Params.catalog) }} -
- {{ else if and (gt .WordCount 200 ) (.Params.toc) }} -
- {{ else }} -
- {{ end }} - -
- - -
-
- - {{ partial "banner" .}} -

{{ .Title }}

- {{ $content | safeHTML }} - {{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }} - {{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }} - -
- - {{ if .Page.Lastmod }} -
- {{ partial "page-meta-links" . }} -
- {{ end }} - - {{ partial "version-list" . }} - {{ partial "qualtrics-feedback.html" }} - - {{ partial "previous-next-links-in-section-with-title.html" . }} -
- -
- - -
- -{{if .Params.script}} - {{ $script := (delimit (slice "scripts" .Params.script) "/")}} - {{ partial (string $script) .}} -{{end }} - -{{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 17edeefb..65ac9cee 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,54 +1,62 @@ {{ define "main" }} -{{/* mf list page */}} -
-
- - -
-
- -
-
-
-{{ end }} + + + + + + +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1fd0ee4d..0dd278ca 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,2 +1,67 @@ -{{ .Render "docs" }} +{{ define "main" }} +
+ +
+ {{ block "header" . }}{{end}} +
+ + +
+ + {{ $content := partial "icon-replacement.html" (dict "content" .Content) }} +
+ +
+
+
+ + {{ partial "banner" .}} +

{{ .Title }}

+ {{ $content | safeHTML }} + {{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }} + {{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }} + +
+ + {{ if .Page.Lastmod }} +
+ {{ partial "page-meta-links" . }} +
+ {{ end }} + + {{ partial "version-list" . }} + {{ partial "qualtrics-feedback.html" }} + + {{ partial "previous-next-links-in-section-with-title.html" . }} + +
+ + +
+ + + + + {{if .Params.script}} + {{ $script := (delimit (slice "scripts" .Params.script) "/")}} + {{ partial (string $script) .}} + {{end }} + +
+ + + +{{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index fe79885f..cfb1663d 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,52 +1,3 @@ {{ define "header" }} - - +I am the header {{ end }} diff --git a/layouts/partials/sidebar-v2.html b/layouts/partials/sidebar-v2.html index cf628c63..a626d4c7 100644 --- a/layouts/partials/sidebar-v2.html +++ b/layouts/partials/sidebar-v2.html @@ -22,6 +22,7 @@ {{ $productName := index $productMap $productIdentifier }} {{ end }} From 941527ef291ada40d55db09f95736d5973755449 Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Fri, 20 Jun 2025 13:24:32 +0100 Subject: [PATCH 03/14] Sidebar: Add image and fix scroll behaviour --- assets/css/v2/style.css | 13 ++++++++----- layouts/partials/sidebar-v2.html | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index a7c3be25..99c0eeb5 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -247,6 +247,7 @@ textarea:not([rows]) { --grid-columns: 12; --sidebar-width: 22rem; + --sidebar-item-padding: 0.25rem 0.75rem; --content-max-width: 88rem; --main-col: minmax(34rem, 50rem); @@ -418,12 +419,12 @@ ol li:last-child { left: 0; width: var(--sidebar-width); height: 100vh; - /* TODO replace with correct color var */ border-right: 1px solid oklch(var(--color-divider)); overflow: hidden; background: oklch(var(--color-background)); box-sizing: border-box; transform: translateX(0); + padding: var(--space-s) 0 var(--space-s) var(--space-s); .sidebar__container { display: grid; @@ -435,16 +436,18 @@ ol li:last-child { top: 0; background: oklch(var(--color-background)); z-index: 1; + padding: var(--sidebar-item-padding); .sidebar__img { - height: 1.75rem; + height: 2rem; } } .sidebar__content { overflow-y: auto; min-height: 0; - width: 100%; + /* allows space for scrollbar */ + width: calc(var(--sidebar-width) - 1rem); scrollbar-gutter: stable; } } @@ -1043,7 +1046,7 @@ nav.sidebar.sidebar__mobile-open { } .sidebar__container button { - padding: 0.25rem 0.75rem; + padding: var(--sidebar-item-padding); justify-content: space-between; } @@ -1105,7 +1108,7 @@ nav.sidebar.sidebar__mobile-open { .sidebar__link { display: block; - padding: 0.25rem 0.75rem; + padding: var(--sidebar-item-padding); margin: 2px 0 2px 0; border-radius: 5px 0 0 5px; color: oklch(0 0 0 / 0.75); diff --git a/layouts/partials/sidebar-v2.html b/layouts/partials/sidebar-v2.html index a626d4c7..7dc690f7 100644 --- a/layouts/partials/sidebar-v2.html +++ b/layouts/partials/sidebar-v2.html @@ -22,7 +22,9 @@ {{ $productName := index $productMap $productIdentifier }} {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 0dd278ca..c52749c6 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,66 +1,53 @@ {{ define "main" }} -
- -
- {{ block "header" . }}{{end}} -
- - -
- - {{ $content := partial "icon-replacement.html" (dict "content" .Content) }} -
+
+ + {{ $content := partial "icon-replacement.html" (dict "content" .Content) }} +
+ +
+
+
+ + {{ partial "banner" .}} +

{{ .Title }}

+ {{ $content | safeHTML }} + {{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }} + {{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }} + +
+ + {{ if .Page.Lastmod }} +
+ {{ partial "page-meta-links" . }} +
+ {{ end }} -
-
-
- - {{ partial "banner" .}} -

{{ .Title }}

- {{ $content | safeHTML }} - {{ if eq .Page.Draft true }}{{ partial "draft-badge.html" . }}{{ end }} - {{ if in .Params.doctypes "beta" }}{{ partial "beta-badge" . }}{{ end }} + {{ partial "version-list" . }} + {{ partial "qualtrics-feedback.html" }} -
+ {{ partial "previous-next-links-in-section-with-title.html" . }} - {{ if .Page.Lastmod }} -
- {{ partial "page-meta-links" . }} -
- {{ end }} +
+ + +
- {{ partial "version-list" . }} - {{ partial "qualtrics-feedback.html" }} - {{ partial "previous-next-links-in-section-with-title.html" . }} - -
- - -
- + +{{if .Params.script}} + {{ $script := (delimit (slice "scripts" .Params.script) "/")}} + {{ partial (string $script) .}} +{{end }} - - {{if .Params.script}} - {{ $script := (delimit (slice "scripts" .Params.script) "/")}} - {{ partial (string $script) .}} - {{end }} -
diff --git a/layouts/redoc/single.html b/layouts/redoc/single.html index 664f3df3..2451793d 100644 --- a/layouts/redoc/single.html +++ b/layouts/redoc/single.html @@ -1,32 +1,14 @@ {{ define "main" }} - -
- - -
- {{ block "header" . }}{{end}} -
- - -
- -
{{ .Content}}
-
- - - - - {{if .Params.script}} - {{ $script := (delimit (slice "scripts" .Params.script) "/")}} - {{ partial (string $script) .}} - {{end }} +
+
{{ .Content}}
+
+ + +{{if .Params.script}} + {{ $script := (delimit (slice "scripts" .Params.script) "/")}} + {{ partial (string $script) .}} +{{end }}
{{ end }} From d53d624487fe230887a5a7704b31cc0b29b89d4a Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Mon, 23 Jun 2025 16:06:46 +0100 Subject: [PATCH 07/14] Header: Fix search and f5 sites --- assets/css/v2/style.css | 41 ++++++++++++++++++++++++++++---- layouts/_default/list.html | 3 +-- layouts/partials/header.html | 36 ++++++++++++++++++++++++++-- layouts/partials/sidebar-v2.html | 2 +- 4 files changed, 73 insertions(+), 9 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index 1c33960a..033b8ca7 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -333,7 +333,7 @@ ol li:last-child { .grid-container { display: grid; grid-template-columns: var(--sidebar-width) 1fr; - grid-template-rows: var(--space-xl) 1fr auto; + grid-template-rows: var(--space-3xl) 1fr auto; grid-template-areas: "sidebar header" "sidebar content" @@ -387,6 +387,41 @@ ol li:last-child { } } + .dropdown-content { + position: absolute; + background-color: oklch(var(--color-background)); + border: oklch(var(--color-foreground)) 1px solid; + box-shadow: 3px 3px 0px oklch(var(--color-shadow)); + z-index: 1; + right: 0; + display: none; + width: 400px; + max-width: 80vw; + margin-right: 2rem; + } + + .dropdown-content ul { + padding: 20px 10px; + } + + .nav-item-explore { + margin: 0; + } + + .navbar-button { + padding: 0.5rem 0.5rem; + border: none; + border-radius: 0.25rem; + text-align: center; + text-decoration: none; + cursor: pointer; + } + + .remove-bottom-radius { + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; + } + ul { list-style: none; } @@ -778,7 +813,7 @@ nav { @media (min-width: 88em) { .text-content { grid-template-columns: var(--grid-content) var(--grid-side-callout); - grid-template-rows: 70px max-content; + grid-template-rows: 3rem max-content; column-gap: var(--grid-column-gutter); } @@ -843,8 +878,6 @@ nav { atomic-search-interface { height: fit-content; - margin-bottom: 2rem; - margin-top: 2rem; } .header-search-box { diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 1c5b0b8e..494edfc9 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -2,7 +2,6 @@
-
- + {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index afa145bd..08824333 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,7 +1,39 @@ {{ define "header" }}
Product Selector
-
Search
-
F5 Sites
+ {{ if ( not ( in .Site.Params.buildtype "package" ) ) }} +
+ + {{ partial "coveo-atomic-search.html" }} +
+ {{ end }} + +
+ {{ $f5Sites := slice + (dict "title" "DevCentral" "url" "https://community.f5.com/" "description" "Connect & learn in our hosted community") + (dict "title" "MyF5" "url" "https://my.f5.com/" "description" "Your key to everything F5, including support, registration keys, and subscriptions") + (dict "title" "NGINX" "url" "https://nginx.org/" "description" "Learn more about NGINX Open Source and read the community blog") + }} + + + +
{{ end }} diff --git a/layouts/partials/sidebar-v2.html b/layouts/partials/sidebar-v2.html index 0c75ba16..fe77a479 100644 --- a/layouts/partials/sidebar-v2.html +++ b/layouts/partials/sidebar-v2.html @@ -1,4 +1,4 @@ -{{ $nginxProducts := slice +{{ $nginxProducts := slice (dict "title" "NGINX One Console" "url" "/nginx-one" "type" "nginx-one") (dict "title" "NGINX Plus" "url" "/nginx" "type" "nginx-one") (dict "title" "NGINX Instance Manager" "url" "/nginx-instance-manager" "type" "nginx-one") From e9b2699f401905dcceb518d1c9f695d9de56bc04 Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Tue, 24 Jun 2025 10:04:18 +0100 Subject: [PATCH 08/14] Search: Fix search page render on new grid --- assets/css/v2/style.css | 38 ++++++++++++++++++++++++++------------ layouts/search/single.html | 2 +- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index 033b8ca7..951572af 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -349,6 +349,32 @@ ol li:last-child { } } +/* Homepage specific layout */ +.grid-container:has(.homepage) { + grid-template-columns: 1fr; + grid-template-areas: + "header" + "content" + "footer"; + + .sidebar { + display: none; + } +} + +/* Search specific layout */ +.grid-container:has(.search) { + grid-template-columns: 1fr; + grid-template-areas: + "header" + "content" + "footer"; + + .sidebar { + display: none; + } +} + .header { grid-area: header; display: flex; @@ -577,18 +603,6 @@ nav { /* MARK: Homepage */ -.grid-container:has(.homepage) { - grid-template-columns: 1fr; - grid-template-areas: - "header" - "content" - "footer"; - - .sidebar { - display: none; - } -} - .homepage { --content-max-width: 120rem; diff --git a/layouts/search/single.html b/layouts/search/single.html index 9d2e1cd1..cbab6a2f 100644 --- a/layouts/search/single.html +++ b/layouts/search/single.html @@ -1,5 +1,5 @@ {{ define "main" }} -
+ {{ end }} From 23ec93bb540c51ac8e4c35664fa340fdff205b2e Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Tue, 24 Jun 2025 10:33:14 +0100 Subject: [PATCH 09/14] Headers: Handle show hide logo depending on page --- assets/css/v2/style.css | 35 ++++++++++++++++++++++++++++++++++- layouts/partials/header.html | 14 +++++++++++--- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index 951572af..8282c4d3 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -246,6 +246,10 @@ textarea:not([rows]) { --grid-gutter: var(--space-s-l, clamp(1rem, 0.4975rem + 2.5126vw, 2.25rem)); --grid-columns: 12; + /* 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; + --sidebar-width: 22rem; --sidebar-item-padding: 0.25rem 0.75rem; --content-max-width: 88rem; @@ -333,7 +337,7 @@ ol li:last-child { .grid-container { display: grid; grid-template-columns: var(--sidebar-width) 1fr; - grid-template-rows: var(--space-3xl) 1fr auto; + grid-template-rows: var(--header-height) 1fr auto; grid-template-areas: "sidebar header" "sidebar content" @@ -347,6 +351,10 @@ ol li:last-child { "content" "footer"; } + + .header__logo { + display: none; + } } /* Homepage specific layout */ @@ -360,6 +368,14 @@ ol li:last-child { .sidebar { display: none; } + + .header__logo { + display: unset; + } + + .header__product-selector { + display: none; + } } /* Search specific layout */ @@ -373,6 +389,10 @@ ol li:last-child { .sidebar { display: none; } + + .header__logo { + display: unset; + } } .header { @@ -388,6 +408,19 @@ ol li:last-child { align-items: center; width: 100%; + .header__img { + height: 2rem; + padding-left: 12px; + } + + .header__search { + width: 14rem; + } + + .header__product-selector { + width: 10rem; + } + > ul { padding: 0; } diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 08824333..88245805 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,14 +1,22 @@ {{ define "header" }}
-
Product Selector
+ + + +
Product Selector
+ {{ if ( not ( in .Site.Params.buildtype "package" ) ) }} -
+ {{ end }} -
+
{{ $f5Sites := slice (dict "title" "DevCentral" "url" "https://community.f5.com/" "description" "Connect & learn in our hosted community") (dict "title" "MyF5" "url" "https://my.f5.com/" "description" "Your key to everything F5, including support, registration keys, and subscriptions") From 03b9f0782c6ab6483b6a8691fbb849cc2db93c01 Mon Sep 17 00:00:00 2001 From: Jack Hickey <133868041+nginx-jack@users.noreply.github.com> Date: Tue, 24 Jun 2025 14:16:37 +0100 Subject: [PATCH 10/14] Headers: Add back product selector --- assets/css/v2/style.css | 36 +++++++++++++++++++-- assets/js/product-selector.js | 21 +++++-------- layouts/partials/header.html | 59 ++++++++++++++++++++++++++++++++++- 3 files changed, 99 insertions(+), 17 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index 8282c4d3..ec1196de 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -419,6 +419,23 @@ ol li:last-child { .header__product-selector { width: 10rem; + + .product-selector__button { + display: flex; + align-items: center; + background: oklch(var(--color-background)); + border: none; + width: 16rem; + font-weight: 500; + cursor: pointer; + color: oklch(var(--color-foreground)); + text-decoration-color: oklch(var(--color-brand) / 0.3); + transition: color 0.15s ease-in-out; + + & :hover { + color: oklch(var(--color-brand)); + } + } } > ul { @@ -1032,18 +1049,31 @@ body:not(:has(.main-layout)) header atomic-search-interface { */ .product-selector { + /* should appear above search box on smaller displays */ + z-index: 11; display: none; position: absolute; top: 0; - min-width: 80%; - margin-top: 8.375rem; - margin-left: 44rem; + margin-top: 4em; padding: 1rem 1.5rem; background-color: oklch(var(--color-background)); border: oklch(var(--color-foreground)) 1px solid; box-shadow: 3px 3px 0px oklch(var(--color-shadow)); } +.product-name { + padding-right: var(--space-s); +} + +.product-selector-button-icon { + color: black; + + svg { + color: black; + stroke: currentColor; + } +} + button:has(~ .product-selector[style*="block"]) > .product-selector-button-icon { transition: transform 0.1s ease-in-out; diff --git a/assets/js/product-selector.js b/assets/js/product-selector.js index 909b9f51..8ce2f0e3 100644 --- a/assets/js/product-selector.js +++ b/assets/js/product-selector.js @@ -4,24 +4,19 @@ document.addEventListener('DOMContentLoaded', () => { 'product-selector-button' ); - if (productSelectorButton === null || productSelectorContent == null) { - return; - } + if (!productSelectorButton || !productSelectorContent) return; productSelectorButton.addEventListener('click', () => { - /* Logic for hiding/showing ONLY when the button is clicked */ - if (productSelectorContent.style.display === 'block') { - productSelectorContent.style.display = 'none'; - productSelectorButton.classList.remove('remove-bottom-radius'); - } else { - productSelectorContent.style.display = 'block'; - productSelectorButton.classList.add('remove-bottom-radius'); - } + const isVisible = productSelectorContent.style.display === 'block'; + productSelectorContent.style.display = isVisible ? 'none' : 'block'; + productSelectorButton.classList.toggle('remove-bottom-radius', !isVisible); }); window.addEventListener('click', (event) => { - /* Greedy Logic to hide the product selector when something other than the button is clicked. Assumes everything has an id containing "product-selector" */ - if (!event.target.id.includes('product-selector')) { + const isClickInside = + productSelectorButton.contains(event.target) || + productSelectorContent.contains(event.target); + if (!isClickInside) { productSelectorContent.style.display = 'none'; productSelectorButton.classList.remove('remove-bottom-radius'); } diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 88245805..9a1849a3 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -7,7 +7,64 @@
-
Product Selector
+
+ {{ $nginxProducts := slice + (dict "title" "NGINX One Console" "url" "/nginx-one" "type" "nginx-one") + (dict "title" "NGINX Plus" "url" "/nginx" "type" "nginx-one") + (dict "title" "NGINX Instance Manager" "url" "/nginx-instance-manager" "type" "nginx-one") + (dict "title" "NGINX Ingress Controller" "url" "/nginx-ingress-controller" "type" "nginx-one") + (dict "title" "NGINX Gateway Fabric" "url" "/nginx-gateway-fabric" "type" "nginx-one") + (dict "title" "NGINX Open Source" "url" "https://nginx.org/en/docs/" "type" "nginx-one") + (dict "title" "NGINX Agent" "url" "/nginx-agent" "type" "nginx-one") + (dict "title" "NGINX App Protect WAF" "url" "/nginx-app-protect-waf" "type" "nginx-app-protect") + (dict "title" "NGINX App Protect DoS" "url" "/nginx-app-protect-dos" "type" "nginx-app-protect") + (dict "title" "NGINX as a Service for Azure" "url" "/nginxaas/azure/" "type" "nginx-as-a-service") + (dict "title" "NGINX Unit" "url" "https://unit.nginx.org/" "type" "nginx-other") + }} + {{ $productMap := dict }} + {{ range $nginxProducts }} + {{ $productId := index (split .url "/") 1 }} + {{ $productMap = merge $productMap (dict $productId .title) }} + {{ end }} + {{ $relPermalink := .RelPermalink }} + {{ $productIdentifier := index ((split $relPermalink "/")) 1 }} + {{ $productName := index $productMap $productIdentifier }} + + +
+ {{ $groupedProducts := dict + "nginx-one" (where $nginxProducts "type" "nginx-one") + "nginx-app-protect" (where $nginxProducts "type" "nginx-app-protect") + "nginx-as-a-service" (where $nginxProducts "type" "nginx-as-a-service") + "nginx-other" (where $nginxProducts "type" "nginx-other") + }} + {{ $orderedKeys := slice "nginx-one" "nginx-app-protect" "nginx-as-a-service" "nginx-other" }} + {{ range $orderedKeys }} + {{ $type := . }} + {{ $products := index $groupedProducts $type }} +
+

{{ $type | humanize | title | upper }}

+ +
+ {{ end }} +
+ + +
{{ if ( not ( in .Site.Params.buildtype "package" ) ) }}
-

{{ .Title }}

+
+ +
+

{{ .Title }}

+ {{ if index .Params "nd-subtitle" }} +

{{ index .Params "nd-subtitle" | markdownify }}

+ {{ end }} +
+
{{ partial "banner" . }} - {{ $hasCustomContent := .Params.hasCustomContent | default false }} + {{ $hasCustomContent := index .Params "nd-landing-page" | default false }} {{ if $hasCustomContent }} {{ .Content }} {{ else }} From 44a5a3d22ecb824539cdfe0e78840b22305d9132 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Tue, 24 Jun 2025 12:39:24 -0700 Subject: [PATCH 14/14] Header: Added default product selector text --- assets/css/v2/style.css | 2 +- layouts/partials/header.html | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/css/v2/style.css b/assets/css/v2/style.css index 9658db3b..afc11bfd 100644 --- a/assets/css/v2/style.css +++ b/assets/css/v2/style.css @@ -454,7 +454,7 @@ ol li:last-child { display: none; width: 400px; max-width: 80vw; - margin-right: 2rem; + margin-right: 1rem; } .dropdown-content ul { diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 9a1849a3..efb40115 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -23,12 +23,14 @@ }} {{ $productMap := dict }} {{ range $nginxProducts }} - {{ $productId := index (split .url "/") 1 }} - {{ $productMap = merge $productMap (dict $productId .title) }} + {{ if not (or (eq .title "NGINX Open Source" ) (eq .title "NGINX Unit")) }} + {{ $productId := index (split .url "/") 1 }} + {{ $productMap = merge $productMap (dict $productId .title) }} + {{ end }} {{ end }} {{ $relPermalink := .RelPermalink }} {{ $productIdentifier := index ((split $relPermalink "/")) 1 }} - {{ $productName := index $productMap $productIdentifier }} + {{ $productName := index $productMap $productIdentifier | default "Product Documentation" }}