diff --git a/README.md b/README.md index 38c7b56e..cbe2449d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,8 @@ Blowfish is designed to be a powerful, lightweight theme for [Hugo](https://gohu - Support for multiple authors - Support for series of articles - Flexible with any content types, taxonomies and menus -- Support for header, footer, and nested menus +- Support for header and footer menus +- Additional support for nested menus - Multilingual content support inlcuding support for RTL languages - Ability to link to posts on third-party websites - Buymeacoffee integration diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 96a66b52..a83eefe4 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1657,6 +1657,10 @@ select { flex-wrap: wrap; } +.items-end { + align-items: flex-end; +} + .items-center { align-items: center; } @@ -1691,6 +1695,12 @@ select { margin-left: calc(1.25rem * calc(1 - var(--tw-space-x-reverse))); } +.space-y-3 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)); +} + .place-self-center { place-self: center; } @@ -1893,6 +1903,10 @@ select { padding: 0.25rem; } +.p-5 { + padding: 1.25rem; +} + .p-0 { padding: 0px; } @@ -2009,6 +2023,10 @@ select { padding-right: 24px; } +.pt-2 { + padding-top: 0.5rem; +} + .pt-16 { padding-top: 4rem; } @@ -2236,6 +2254,16 @@ select { box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); } +.ring-1 { + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); +} + +.ring-opacity-5 { + --tw-ring-opacity: 0.05; +} + .backdrop-blur { --tw-backdrop-blur: blur(8px); -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia); @@ -3013,6 +3041,25 @@ body:has(#menu-controller:checked) { z-index: 100; } +.nested-menu:hover + .menuhide { + visibility: visible; + opacity: 1; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; +} + +.menuhide:hover { + visibility: visible; + opacity: 1; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; +} + +.menuhide { + visibility: hidden; + opacity: 0; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; + z-index: 1000; +} + .first\:mt-8:first-child { margin-top: 2rem; } @@ -3493,20 +3540,11 @@ body:has(#menu-controller:checked) { padding-right: 1.5rem; } - .sm\:py-10 { - padding-top: 2.5rem; - padding-bottom: 2.5rem; - } - .sm\:py-24 { padding-top: 6rem; padding-bottom: 6rem; } - .sm\:pt-10 { - padding-top: 2.5rem; - } - .sm\:pl-6 { padding-left: 1.5rem; } diff --git a/assets/css/main.css b/assets/css/main.css index f23b3095..40a6d8aa 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -420,5 +420,24 @@ body:has(#menu-controller:checked) { } .medium-zoom-image--opened { - z-index: 100; + z-index: 100; +} + +.nested-menu:hover + .menuhide { + visibility: visible; + opacity: 1; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; +} + +.menuhide:hover { + visibility: visible; + opacity: 1; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; +} + +.menuhide { + visibility: hidden; + opacity: 0; + transition: visibility 0.3s, opacity 0.3s ease-in-out ; + z-index: 1000; } \ No newline at end of file diff --git a/assets/js/header.js b/assets/js/header.js deleted file mode 100644 index 1e576c6c..00000000 --- a/assets/js/header.js +++ /dev/null @@ -1,11 +0,0 @@ -function header_toggle_nested_menu(element) { - if (!element) { - throw new Error("Could not find button") - } - let parent_element = element.parentElement; - if(!parent_element) { - throw new Error("Could not get parent element from button") - } - let nested_menu = parent_element.querySelector(".header-nested-menu") - nested_menu.classList.toggle('hidden'); -} diff --git a/config/_default/menus.en.toml b/config/_default/menus.en.toml index 384fc92e..7c25e422 100644 --- a/config/_default/menus.en.toml +++ b/config/_default/menus.en.toml @@ -15,6 +15,22 @@ # pageRef = "posts" # weight = 10 +#[[main]] +# name = "Parent" +# weight = 20 + +#[[main]] +# name = "example sub-menu 1" +# parent = "Parent" +# pageRef = "posts" +# weight = 20 + +#[[main]] +# name = "example sub-menu 2" +# parent = "Parent" +# pageRef = "posts" +# weight = 20 + #[[main]] # name = "Categories" # pageRef = "categories" diff --git a/exampleSite/config/_default/menus.en.toml b/exampleSite/config/_default/menus.en.toml index 4ea8acf8..7b30ce0d 100644 --- a/exampleSite/config/_default/menus.en.toml +++ b/exampleSite/config/_default/menus.en.toml @@ -16,25 +16,26 @@ weight = 10 [[main]] - name = "Parent" + name = "Nested Menu" pageRef = "samples" weight = 20 [[main]] - name = "test1" - parent = "Parent" + name = "sub-menu 1" + parent = "Nested Menu" pageRef = "samples" weight = 20 [[main]] - name = "test2" - parent = "Parent" + name = "sub-menu 2" + parent = "Nested Menu" pageRef = "samples" weight = 20 [[main]] - name = "test3" - parent = "Parent" + name = "sub-menu 3" + parent = "Nested Menu" + pre = "github" pageRef = "samples" weight = 20 diff --git a/exampleSite/content/docs/getting-started/index.md b/exampleSite/content/docs/getting-started/index.md index 3f6aaedf..76f60aa8 100644 --- a/exampleSite/content/docs/getting-started/index.md +++ b/exampleSite/content/docs/getting-started/index.md @@ -197,36 +197,33 @@ Both menus are completely optional and can be commented out if not required. Use ### Nested Menus -bla bla bla +The theme also supports nested menus. In order to use them you just need to define a parent entry in `menu.toml` and its sub-menus using the `parent` parameter to reference the parent. All properties can be used for sub-menus. Note that `pageRef` and `url` will be ignored for the parent entry. Nested menus is only available in the main menu not for the footer. ```toml # config/_default/menus.toml [[main]] - name = "Blog" - pageRef = "posts" - weight = 10 - -[[main]] - name = "Topics" - pageRef = "topics" + name = "Parent" weight = 20 [[main]] - pre = "github" - name = "GitHub" - url = "https://github.com/nunocoracao/blowfish" - weight = 30 + name = "sub-menu 1" + parent = "Parent" + pageRef = "samples" + weight = 20 [[main]] - identifier = "github2" - pre = "github" - url = "https://github.com/nunocoracao/blowfish" - weight = 40 + name = "sub-menu 2" + parent = "Parent" + pageRef = "samples" + weight = 20 -[[footer]] - name = "Privacy" - url = "https://external-link" +[[main]] + name = "sub-menu 3" + parent = "Parent" + pre = "github" + pageRef = "samples" + weight = 20 ``` ## Thumbnails & Backgrounds diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 839b554b..8005f8c9 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -86,11 +86,6 @@ {{ end }} - {{/* Header */}} - {{ $headerLib := resources.Get "js/header.js" }} - {{ $headerLib := $headerLib | resources.Minify }} - {{ $headerJS := $headerLib | resources.Fingerprint "sha512" }} - {{/* Site Verification */}} {{ with .Site.Params.verification.google }} diff --git a/layouts/partials/header/basic.html b/layouts/partials/header/basic.html index 4f5de3bc..1ae3afe4 100644 --- a/layouts/partials/header/basic.html +++ b/layouts/partials/header/basic.html @@ -17,30 +17,30 @@
+
@@ -65,7 +65,7 @@ {{ if .Site.Params.enableSearch | default false }} {{ end }} @@ -94,38 +94,21 @@
-
- -{{ if .Site.Menus.subnavigation }} -
-
- -
-
-{{ end }} + \ No newline at end of file diff --git a/layouts/partials/header/header-mobile-option-nested.html b/layouts/partials/header/header-mobile-option-nested.html new file mode 100644 index 00000000..94edcc8a --- /dev/null +++ b/layouts/partials/header/header-mobile-option-nested.html @@ -0,0 +1,30 @@ +
  • + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

    + {{ .Name | markdownify | emojify }} +

    + + {{ partial "icon.html" "chevron-down" }} + +
    +
  • +{{ range .Children }} +
  • + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

    + {{ .Name | markdownify | emojify }} +

    +
    +
  • +{{ end }} \ No newline at end of file diff --git a/layouts/partials/header/header-mobile-option-simple.html b/layouts/partials/header/header-mobile-option-simple.html new file mode 100644 index 00000000..7ef286b7 --- /dev/null +++ b/layouts/partials/header/header-mobile-option-simple.html @@ -0,0 +1,13 @@ +
  • + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

    + {{ .Name | markdownify | emojify }} +

    +
    +
  • \ No newline at end of file diff --git a/layouts/partials/header/header-mobile-option.html b/layouts/partials/header/header-mobile-option.html new file mode 100644 index 00000000..17031197 --- /dev/null +++ b/layouts/partials/header/header-mobile-option.html @@ -0,0 +1,5 @@ +{{ if .HasChildren }} + {{ partial "header/header-mobile-option-nested.html" . }} +{{ else }} + {{ partial "header/header-mobile-option-simple.html" . }} +{{ end }} diff --git a/layouts/partials/header/header-option-nested.html b/layouts/partials/header/header-option-nested.html index 87394963..d18f122c 100644 --- a/layouts/partials/header/header-option-nested.html +++ b/layouts/partials/header/header-option-nested.html @@ -1,8 +1,45 @@ -
    +
    +
    + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} + + {{ .Name | markdownify | emojify }} + + + {{ partial "icon.html" "chevron-down" }} + +
    + +
    + + + + \ No newline at end of file diff --git a/layouts/partials/header/header-option-simple.html b/layouts/partials/header/header-option-simple.html index fa36ac68..27865389 100644 --- a/layouts/partials/header/header-option-simple.html +++ b/layouts/partials/header/header-option-simple.html @@ -1,5 +1,11 @@ - - {{ partial "icon.html" .Pre }} - {{ if and .Pre .Name }}   {{ end }} - {{ .Name | markdownify | emojify }} - + + {{ if .Pre }} + + {{ partial "icon.html" .Pre }} + + {{ end }} +

    + {{ .Name | markdownify | emojify }} +

    +
    \ No newline at end of file