From ab228b2643cc92c5f9d200efa870304355eeca2b Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Tue, 1 Feb 2022 09:57:11 +0100 Subject: [PATCH 1/2] feat: add support for sub navigation main menu --- assets/scss/common/_dark.scss | 16 ++++++++++++++++ assets/scss/components/_buttons.scss | 27 +++++++++++++++++++++++++++ config/_default/menus/menus.en.toml | 27 +++++++++++++++++++++++++++ layouts/partials/header/header.html | 23 ++++++++++++++++++++--- 4 files changed, 90 insertions(+), 3 deletions(-) diff --git a/assets/scss/common/_dark.scss b/assets/scss/common/_dark.scss index f958836..c312215 100644 --- a/assets/scss/common/_dark.scss +++ b/assets/scss/common/_dark.scss @@ -527,3 +527,19 @@ $navbar-dark-active-color: $link-color-dark; border-color: $border-dark; } } + +[data-dark-mode] .dropdown-menu.dropdown-menu-main { + background: $body-overlay-dark; +} + +[data-dark-mode] .dropdown-menu-main .dropdown-item { + color: $body-color-dark; +} + +[data-dark-mode] .dropdown-menu-main .dropdown-item:hover { + color: $link-color-dark; +} + +[data-dark-mode] .dropdown-menu-main .dropdown-item.active { + color: $link-color-dark; +} diff --git a/assets/scss/components/_buttons.scss b/assets/scss/components/_buttons.scss index 7e22328..9cb51e5 100644 --- a/assets/scss/components/_buttons.scss +++ b/assets/scss/components/_buttons.scss @@ -218,3 +218,30 @@ pre { margin-left: -0.1875rem; margin-right: -0.3125rem; } + +.dropdown-menu.dropdown-menu-main { + width: 100%; +} + +.dropdown-menu-main .dropdown-item { + color: inherit; + font-size: $font-size-base; + font-weight: 400; + text-decoration: none; +} + +.dropdown-menu-main .dropdown-item:hover { + background-color: transparent; + color: $primary; +} + +.dropdown-menu-main .dropdown-item.active { + color: $primary; + font-weight: 400; + text-decoration: none; + background-color: inherit; +} + +.dropdown-menu-main .dropdown-item.active:hover { + background-color: transparent; +} diff --git a/config/_default/menus/menus.en.toml b/config/_default/menus/menus.en.toml index 6bcf3f2..21daea8 100644 --- a/config/_default/menus/menus.en.toml +++ b/config/_default/menus/menus.en.toml @@ -44,6 +44,33 @@ url = "/blog/" weight = 20 +[[main]] + name = "Prologue" + weight = 30 + identifier = "prologue" + url = "/docs/prologue/" + +[[main]] + name = "Introduction" + weight = 35 + identifier = "introduction" + url = "/docs/prologue/introduction/" + parent = "prologue" + +[[main]] + name = "Quick Start" + weight = 40 + identifier = "quick-start" + url = "/docs/prologue/quick-start/" + parent = "prologue" + +[[main]] + name = "Commands" + weight = 45 + identifier = "commands" + url = "/docs/prologue/commands/" + parent = "prologue" + [[social]] name = "GitHub" pre = "" diff --git a/layouts/partials/header/header.html b/layouts/partials/header/header.html index 1d6f0bc..fa1d51f 100644 --- a/layouts/partials/header/header.html +++ b/layouts/partials/header/header.html @@ -34,9 +34,26 @@ {{- $active = or $active (eq .Name $current.Title) -}} {{- $active = or $active (and (eq .Name ($section | humanize)) (eq $current.Section $section)) -}} {{- $active = or $active (and (eq .Name "Blog") (eq $current.Section "blog" "contributors")) -}} - + {{ if .HasChildren }} + + {{ else }} + + {{ end }} {{ end -}}
From ef830bf244d78749554655dde54ed1eb355d28d6 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Tue, 1 Feb 2022 11:00:25 +0100 Subject: [PATCH 2/2] config: set to new default --- config/_default/menus/menus.en.toml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/config/_default/menus/menus.en.toml b/config/_default/menus/menus.en.toml index 21daea8..5e24b86 100644 --- a/config/_default/menus/menus.en.toml +++ b/config/_default/menus/menus.en.toml @@ -45,31 +45,24 @@ weight = 20 [[main]] - name = "Prologue" + name = "Get Started" weight = 30 - identifier = "prologue" - url = "/docs/prologue/" - -[[main]] - name = "Introduction" - weight = 35 - identifier = "introduction" + identifier = "get-started" url = "/docs/prologue/introduction/" - parent = "prologue" [[main]] name = "Quick Start" weight = 40 identifier = "quick-start" url = "/docs/prologue/quick-start/" - parent = "prologue" + parent = "get-started" [[main]] - name = "Commands" - weight = 45 - identifier = "commands" - url = "/docs/prologue/commands/" - parent = "prologue" + name = "Tutorial" + weight = 50 + identifier = "tutorial" + url = "https://getdoks.org/tutorial/introduction/" + parent = "get-started" [[social]] name = "GitHub"