feat(navbar): port logo, submenus, button

add `header.navbar.fixed_to_top` bool option

make biography blox compatible with dark section class

center views in Collections and List tpl

add features and feature_icon options to cta-image-paragraph view
This commit is contained in:
George Cushen 2023-12-14 23:55:19 +00:00
commit 5a4b7ec721
22 changed files with 3910 additions and 1654 deletions

View file

@ -103,11 +103,11 @@ body:
- Microsoft Edge
- Other
- type: input
id: wowchemy-tpl
id: hb-tpl
attributes:
label: Which Wowchemy template are you using?
description: 'For example, a template from https://hugoblox.com/hugo-themes/'
placeholder: 'e.g., Academic Resume'
label: Which Hugo Blox template are you using?
description: 'For example, a template from https://hugoblox.com/templates/'
placeholder: 'e.g., Academic CV'
validations:
required: true
- type: input

View file

@ -2,6 +2,7 @@
**/vendor/
**/_vendor/
**/libs/
**/dist/
public/
blox-bootstrap/assets/scss/main.scss

View file

@ -3,17 +3,17 @@
**************************************************/
/* MOVED TO HTML */
/*.skill-group-title {*/
/* display: inline-block;*/
/* margin-bottom: 15px;*/
/* padding-bottom: 5px;*/
/* border-bottom: 2px solid #c7c7c7;*/
/* font-size: 1rem;*/
/* line-height: 30px;*/
/* font-weight: 600;*/
/* text-transform: uppercase;*/
/* letter-spacing: 1px;*/
/*}*/
/* .skill-group-title { */
/* display: inline-block; */
/* margin-bottom: 15px; */
/* padding-bottom: 5px; */
/* border-bottom: 2px solid #c7c7c7; */
/* font-size: 1rem; */
/* line-height: 30px; */
/* font-weight: 600; */
/* text-transform: uppercase; */
/* letter-spacing: 1px; */
/* } */
.skills-content {
margin-bottom: 15px;
@ -21,15 +21,15 @@
.skills-name {
margin-bottom: 6px;
/*color: #888;*/ /* Inaccessible */
/* color: #888; */ /* Inaccessible */
font-size: 1rem;
letter-spacing: 1px;
text-transform: uppercase;
}
/*.dark .skills-name {*/
/* color: #eee;*/
/*}*/
/* .dark .skills-name { */
/* color: #eee; */
/* } */
.skills-description {
margin-bottom: 6px;

View file

@ -0,0 +1,71 @@
/* Navigation Styles */
.navbar {
@apply relative flex flex-wrap items-center justify-between;
}
.navbar-brand {
@apply text-black dark:text-white text-xl font-semibold;
}
.navbar-brand svg {
@apply max-h-full max-w-full h-[1em] w-auto inline-block;
}
.navbar-brand img {
/* To shrink to line height, add: h-[1em] */
@apply max-h-full w-auto inline-block;
}
/* navbar toggler */
input#nav-toggle:checked + label #show-button {
@apply hidden;
}
input#nav-toggle:checked + label #hide-button {
@apply block;
}
input#nav-toggle:checked ~ #nav-menu {
@apply block;
}
#site-header.header {
@apply bg-white dark:bg-slate-900 py-3 shadow;
}
/* navbar items */
.navbar-nav {
@apply text-center lg:text-left;
}
.nav-link {
@apply hover:text-primary-700 dark:hover:text-primary-300 dark:text-white block p-3 font-semibold transition lg:px-2 lg:py-3;
}
.nav-dropdown {
@apply mr-0;
& > svg {
@apply pointer-events-none;
}
&.active {
.nav-dropdown-list {
@apply block;
}
}
}
.nav-dropdown-list {
@apply bg-white dark:bg-slate-900 z-10 min-w-[180px] rounded py-4 shadow hidden lg:invisible lg:absolute lg:block lg:opacity-0;
}
.nav-dropdown-item {
@apply px-4 [&:not(:last-child)]:mb-2 dark:hover:bg-primary-500;
}
.nav-dropdown-link {
@apply hover:text-primary-700 dark:text-white dark:hover:text-white block py-1 font-semibold transition;
}

View file

@ -3,5 +3,6 @@
/*! Hugo Blox Components | https://hugoblox.com */
@import "main.css";
@import "nav.css";
@import "./components/all.css";
@import "./blox/all.css";

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,21 @@
// Navigation
const applyScrollPadding = () => {
const header = document.querySelector('.page-header');
let position = header.getBoundingClientRect();
document.documentElement.style.scrollPaddingTop = position.height.toString() + 'px';
};
window.addEventListener("DOMContentLoaded", () => {
const dropdownMenus = document.querySelectorAll(
".nav-dropdown > .nav-link",
);
dropdownMenus.forEach((toggler) => {
toggler?.addEventListener("click", (e) => {
e.target.parentElement.classList.toggle("active");
});
});
applyScrollPadding()
});

View file

@ -1,3 +0,0 @@
# Wowchemy metadata
version = "0.1.0"

View file

@ -0,0 +1,3 @@
# Hugo Blox metadata
version: "0.1.0"

File diff suppressed because it is too large Load diff

View file

@ -1,82 +0,0 @@
# Page Sharer
# Documentation: https://docs.hugoblox.com/reference/page-sharer/
[[buttons]]
id = "twitter"
url = "https://twitter.com/intent/tweet?url={url}&text={title}"
title = "Twitter"
icon_pack = "fab"
icon = "twitter"
enable = true
[[buttons]]
id = "facebook"
url = "https://www.facebook.com/sharer.php?u={url}&t={title}"
title = "Facebook"
icon_pack = "fab"
icon = "facebook"
enable = true
[[buttons]]
id = "email"
url = "mailto:?subject={title}&body={url}"
title = "Email"
icon_pack = "fas"
icon = "envelope"
enable = true
[[buttons]]
id = "linkedin"
url = "https://www.linkedin.com/shareArticle?url={url}&title={title}"
title = "LinkedIn"
icon_pack = "fab"
icon = "linkedin-in"
enable = true
[[buttons]]
id = "whatsapp"
url = "whatsapp://send?text={title}%20{url}"
title = "WhatsApp"
icon_pack = "fab"
icon = "whatsapp"
enable = true
[[buttons]]
id = "weibo"
url = "https://service.weibo.com/share/share.php?url={url}&title={title}"
title = "Weibo"
icon_pack = "fab"
icon = "weibo"
enable = true
[[buttons]]
id = "reddit"
url = "https://reddit.com/submit?url={url}&title={title}"
title = "Reddit"
icon_pack = "fab"
icon = "reddit-alien"
enable = false
[[buttons]]
id = "pinterest"
url = "https://pinterest.com/pin/create/link/?url={url}&description={title}"
title = "Pinterest"
icon_pack = "fab"
icon = "pinterest"
enable = false
[[buttons]]
id = "xing"
url = "https://www.xing.com/spi/shares/new?url={url}&title={title}"
title = "Xing"
icon_pack = "fab"
icon = "xing"
enable = false
[[buttons]]
id = "tumblr"
url = "https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}"
title = "Tumblr"
icon_pack = "fab"
icon = "tumblr"
enable = false

View file

@ -0,0 +1,65 @@
# Hugo Blox
# Social sharing buttons
# Docs: https://docs.hugoblox.com/reference/page-sharer/
buttons:
- id: twitter
url: 'https://twitter.com/intent/tweet?url={url}&text={title}'
title: Twitter
icon_pack: fab
icon: twitter
enable: true
- id: facebook
url: 'https://www.facebook.com/sharer.php?u={url}&t={title}'
title: Facebook
icon_pack: fab
icon: facebook
enable: true
- id: email
url: 'mailto:?subject={title}&body={url}'
title: Email
icon_pack: fas
icon: envelope
enable: true
- id: linkedin
url: 'https://www.linkedin.com/shareArticle?url={url}&title={title}'
title: LinkedIn
icon_pack: fab
icon: linkedin-in
enable: true
- id: whatsapp
url: 'whatsapp://send?text={title}%20{url}'
title: WhatsApp
icon_pack: fab
icon: whatsapp
enable: true
- id: weibo
url: 'https://service.weibo.com/share/share.php?url={url}&title={title}'
title: Weibo
icon_pack: fab
icon: weibo
enable: true
- id: reddit
url: 'https://reddit.com/submit?url={url}&title={title}'
title: Reddit
icon_pack: fab
icon: reddit-alien
enable: false
- id: pinterest
url: 'https://pinterest.com/pin/create/link/?url={url}&description={title}'
title: Pinterest
icon_pack: fab
icon: pinterest
enable: false
- id: xing
url: 'https://www.xing.com/spi/shares/new?url={url}&title={title}'
title: Xing
icon_pack: fab
icon: xing
enable: false
- id: tumblr
url: 'https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}'
title: Tumblr
icon_pack: fab
icon: tumblr
enable: false

View file

@ -5,9 +5,9 @@
<html lang="{{$language_code}}" {{ if in site.Data.i18n.rtl.rtl $language_code }}dir="rtl"{{else}}dir="ltr"{{end}}
data-wc-theme-default="{{ (lower site.Params.appearance.mode) | default "system" }}">
{{ partial "site_head" . }}
<body class="dark:bg-gray-800 dark:text-white-800 page-wrapper">
<body class="dark:bg-gray-800 dark:text-white-800 page-wrapper" id="top">
<div id="page-bg"></div>
<div class="page-header">
<div class="page-header {{ if site.Params.header.navbar.fixed_to_top }}sticky top-0 z-30{{ end }}">
{{/* Load header block */}}
{{ $show_navbar := ((site.Params.header.navbar.enable | default true) | and (ne .Params.header.navbar.enable false)) | or .Params.header.navbar.enable }}
{{ if $show_navbar }}

View file

@ -10,7 +10,7 @@
{{ $view := .Params.view | default "card" }}
{{ $block := . }}
<div class="flex flex-col justify-center">
<div class="flex flex-col items-center">
{{ partial "functions/render_view" (dict "fragment" "start" "page" $block "item" . "view" $view) }}

View file

@ -46,7 +46,7 @@
</div>
{{ end }}
<div class="portrait-title">
<div class="portrait-title dark:text-white">
<div class="text-3xl font-bold mb-2 mt-6">
{{- if $person.name_pronunciation -}}
@ -70,7 +70,7 @@
{{ end }}
</div>
<ul class="network-icon">
<ul class="network-icon dark:text-zinc-100">
{{ range $person.profiles }}
{{ $pack := or .icon_pack "fas" }}
{{ $pack_prefix := $pack }}

View file

@ -89,6 +89,8 @@
</div>
{{ end }}
<div class="flex flex-col items-center">
{{ partial "functions/render_view" (dict "fragment" "start" "page" $block "item" . "view" $view) }}
{{ range $index, $item := $query }}
@ -97,40 +99,42 @@
{{ partial "functions/render_view" (dict "fragment" "end" "page" $block "item" . "view" $view) }}
{{/* Archive link */}}
{{ $show_archive_link := $block.content.archive.enable | default (gt $count $items_count) }}
{{ if $show_archive_link | and $archive_page }}
{{ $archive_link := "" }}
{{ if $block.content.archive.link }}
{{ $archive_link = $block.content.archive.link | relLangURL }}
{{ else }}
{{ $archive_link = $archive_page.RelPermalink }}
{{ end }}
{{/* Localisation */}}
{{ $items_type := $archive_page.Type }}
{{ $i18n := "" }}
{{ if eq $items_type "post" }}
{{ $i18n = "more_posts" }}
{{ else if eq $items_type "event" }}
{{ $i18n = "more_talks" }}
{{ else if eq $items_type "publication" }}
{{ $i18n = "more_publications" }}
{{ else }}
{{ $i18n = "more_pages" }}
{{ end }}
{{ $archive_text := $block.content.archive.text | default (i18n $i18n) | default "See all" }}
<div class="container mx-auto max-w-screen-lg px-8 xl:px-5 pb-5 lg:pb-8">
<div class="mt-10 flex justify-center">
<a
class="relative inline-flex items-center gap-1 rounded-md border border-gray-300 bg-white px-3 py-2 pl-4 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20 dark:border-gray-500 dark:bg-gray-800 dark:text-gray-300"
href="{{ $archive_link }}">
<span>{{ $archive_text | emojify }}</span>
</a>
</div>
</div>
{{/* Archive link */}}
{{ $show_archive_link := $block.content.archive.enable | default (gt $count $items_count) }}
{{ if $show_archive_link | and $archive_page }}
{{ $archive_link := "" }}
{{ if $block.content.archive.link }}
{{ $archive_link = $block.content.archive.link | relLangURL }}
{{ else }}
{{ $archive_link = $archive_page.RelPermalink }}
{{ end }}
{{/* Localisation */}}
{{ $items_type := $archive_page.Type }}
{{ $i18n := "" }}
{{ if eq $items_type "post" }}
{{ $i18n = "more_posts" }}
{{ else if eq $items_type "event" }}
{{ $i18n = "more_talks" }}
{{ else if eq $items_type "publication" }}
{{ $i18n = "more_publications" }}
{{ else }}
{{ $i18n = "more_pages" }}
{{ end }}
{{ $archive_text := $block.content.archive.text | default (i18n $i18n) | default "See all" }}
<div class="container mx-auto max-w-screen-lg px-8 xl:px-5 pb-5 lg:pb-8">
<div class="mt-10 flex justify-center">
<a
class="relative inline-flex items-center gap-1 rounded-md border border-gray-300 bg-white px-3 py-2 pl-4 text-sm font-medium text-gray-500 hover:bg-gray-50 focus:z-20 dark:border-gray-500 dark:bg-gray-800 dark:text-gray-300"
href="{{ $archive_link }}">
<span>{{ $archive_text | emojify }}</span>
</a>
</div>
</div>
{{ end }}

View file

@ -17,8 +17,19 @@
<div class="mt-4 md:mt-0">
<h2 class="mb-4 text-4xl tracking-tight font-extrabold text-gray-900 dark:text-white">{{$title}}</h2>
<p class="mb-6 font-light text-gray-500 md:text-lg dark:text-gray-400">{{$text}}</p>
{{ $icon := .feature_icon | default "check" }}
{{ if .features }}
<ul>
{{ range .features }}
<li class="relative mb-4 pl-6">
{{ partial "functions/get_icon" (dict "name" $icon "attributes" `class="inline-block pr-3" style="height: 1em;"`) }}
{{ . | markdownify }}
</li>
{{ end }}
</ul>
{{ end }}
{{ with .button }}
<a href="{{.url}}" class="inline-flex items-center text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-primary-900">
<a href="{{.url}}" class="mt-3 inline-flex items-center text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:focus:ring-primary-900">
{{.text}}
<svg class="ml-2 -mr-1 w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg>
</a>

View file

@ -0,0 +1,122 @@
<!-- Main navigation container -->
{{/* Show site search? */}}
{{ $show_search := site.Params.header.navbar.show_search | default false }}
<nav
class="relative flex w-full flex-nowrap items-center justify-between bg-white py-2 text-neutral-500 shadow-lg hover:text-neutral-700 focus:text-neutral-700 dark:bg-slate-900 lg:flex-wrap lg:justify-start lg:py-4"
data-te-navbar-ref>
<div class="flex w-full flex-wrap items-center justify-between px-3">
<!-- Hamburger button for mobile view -->
<button
class="block border-0 bg-transparent px-2 text-neutral-500 hover:no-underline hover:shadow-none focus:no-underline focus:shadow-none focus:outline-none focus:ring-0 dark:text-neutral-200 lg:hidden"
type="button"
data-te-collapse-init
data-te-target="#collapse-main-navbar"
aria-controls="collapse-main-navbar"
aria-expanded="false"
aria-label="Toggle navigation" onclick="toggleNavbar('collapse-main-navbar')">
<!-- Hamburger icon -->
<span class="[&>svg]:w-7">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class="h-7 w-7">
<path
fill-rule="evenodd"
d="M3 6.75A.75.75 0 013.75 6h16.5a.75.75 0 010 1.5H3.75A.75.75 0 013 6.75zM3 12a.75.75 0 01.75-.75h16.5a.75.75 0 010 1.5H3.75A.75.75 0 013 12zm0 5.25a.75.75 0 01.75-.75h16.5a.75.75 0 010 1.5H3.75a.75.75 0 01-.75-.75z"
clip-rule="evenodd" />
</svg>
</span>
</button>
<!-- Collapsible navbar container -->
<div
class="!visible mt-2 hidden flex-grow basis-[100%] items-center justify-center lg:mt-0 lg:!flex lg:basis-auto"
id="collapse-main-navbar"
data-te-collapse-item>
<!-- Main links -->
{{- $currentPage := . }}
<ul
class="list-style-none flex flex-col pl-0 lg:mt-1 lg:flex-row items-center"
data-te-navbar-nav-ref>
{{- range site.Menus.main }}
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
{{- $page_url:= $currentPage.Permalink | absLangURL }}
{{- $active := eq $menu_item_url $page_url -}}
{{- $activeClass := cond $active "active" "" -}}
<!-- Home link [&.active]:text-bold [&.active]:text-black/90 dark:[&.active]:text-neutral-300-->
<li
class="my-4 pl-2 lg:my-0 lg:pl-2 lg:pr-1"
data-te-nav-item-ref>
<a
class="lg:px-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white {{ $activeClass }}"
aria-current="page"
href="{{ .URL | relLangURL }}"
data-te-nav-link-ref
>{{- .Name -}}</a
>
</li>
{{ end }}
{{ if $show_search }}
<li class="my-4 pl-2 lg:my-0 lg:pl-2 lg:pr-1">
<a
class="lg:px-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white"
aria-current="page"
href="#"
id="search_toggle"
>{{- i18n "search" -}}</a
>
</li>
{{ end }}
{{ $show_theme_chooser := site.Params.header.navbar.show_theme_chooser | default true }}
{{ if $show_theme_chooser }}
<li class="lg:px-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white">
<button class="theme-toggle mt-1" accesskey="t" title="">
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="dark:hidden">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
<svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class=" dark:block [&:not(dark)]:hidden">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
</li>
{{ end }}
{{ $show_translations := site.Params.header.navbar.show_translations | default true }}
{{ if .IsTranslated | and $show_translations }}
<li class="lg:px-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white">
{{- partial "components/language-chooser.html" (dict "page" .) -}}
</li>
{{ end }}
</ul>
</div>
</div>
</nav>
{{ if $show_search }}
<div id="search" class="hidden p-3"></div>
{{ end }}
<script>
function toggleNavbar(collapseID){
document.getElementById(collapseID).classList.toggle("hidden");
document.getElementById(collapseID).classList.toggle("flex");
}
</script>

View file

@ -1,171 +1,197 @@
<!-- Main navigation container -->
{{/* Show site search? */}}
{{ $show_search := site.Params.header.navbar.show_search | default false }}
{{ if $show_search }}
{{ $pf_css := resources.Get "dist/pagefind/pagefind-ui.css" }}
{{ $pf_css = $pf_css | resources.Fingerprint "sha256" }}
<link type="text/css" rel="stylesheet" href="{{ $pf_css.RelPermalink }}" integrity="{{ $pf_css.Data.Integrity }}" />
{{ $pf_js := resources.Get "dist/pagefind/pagefind-ui.js" }}
{{ $pf_js = $pf_js | resources.Fingerprint "sha256" }}
<script src="{{ $pf_js.RelPermalink }}" integrity="{{ $pf_js.Data.Integrity }}"></script>
<style>
html.dark {
--pagefind-ui-primary: #eeeeee;
--pagefind-ui-text: #eeeeee;
--pagefind-ui-background: #152028;
--pagefind-ui-border: #152028;
--pagefind-ui-tag: #152028;
}
</style>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({ element: "#search", showSubResults: true });
});
document.addEventListener('DOMContentLoaded', () => {
let element = document.getElementById('search');
let trigger = document.getElementById('search_toggle');
if (trigger) {
trigger.addEventListener('click', () => {
element.classList.toggle('hidden');
element.querySelector("input").value = ""
element.querySelector("input").focus()
if (!element.classList.contains('hidden')) {
let clear_trigger = document.querySelector('.pagefind-ui__search-clear');
if (clear_trigger && !clear_trigger.hasAttribute('listenerOnClick')) {
clear_trigger.setAttribute('listenerOnClick', 'true');
clear_trigger.addEventListener('click', () => {
element.classList.toggle('hidden');
});
}
}
});
}
});
</script>
{{ end }}
<nav
class="relative flex w-full flex-nowrap items-center justify-between bg-white py-2 text-neutral-500 shadow-lg hover:text-neutral-700 focus:text-neutral-700 dark:bg-slate-900 lg:flex-wrap lg:justify-start lg:py-4"
data-te-navbar-ref>
<div class="flex w-full flex-wrap items-center justify-between px-3">
<!-- Hamburger button for mobile view -->
<button
class="block border-0 bg-transparent px-2 text-neutral-500 hover:no-underline hover:shadow-none focus:no-underline focus:shadow-none focus:outline-none focus:ring-0 dark:text-neutral-200 lg:hidden"
type="button"
data-te-collapse-init
data-te-target="#collapse-main-navbar"
aria-controls="collapse-main-navbar"
aria-expanded="false"
aria-label="Toggle navigation" onclick="toggleNavbar('collapse-main-navbar')">
<!-- Hamburger icon -->
<span class="[&>svg]:w-7">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="currentColor"
class="h-7 w-7">
<path
fill-rule="evenodd"
d="M3 6.75A.75.75 0 013.75 6h16.5a.75.75 0 010 1.5H3.75A.75.75 0 013 6.75zM3 12a.75.75 0 01.75-.75h16.5a.75.75 0 010 1.5H3.75A.75.75 0 013 12zm0 5.25a.75.75 0 01.75-.75h16.5a.75.75 0 010 1.5H3.75a.75.75 0 01-.75-.75z"
clip-rule="evenodd" />
</svg>
</span>
</button>
<!-- Collapsible navbar container -->
<div
class="!visible mt-2 hidden flex-grow basis-[100%] items-center justify-center lg:mt-0 lg:!flex lg:basis-auto"
id="collapse-main-navbar"
data-te-collapse-item>
<!-- Main links -->
{{- $currentPage := . }}
<ul
class="list-style-none flex flex-col pl-0 lg:mt-1 lg:flex-row items-center"
data-te-navbar-nav-ref>
{{- range site.Menus.main }}
{{- $menu_item_url := (cond (strings.HasSuffix .URL "/") .URL (printf "%s/" .URL) ) | absLangURL }}
{{- $page_url:= $currentPage.Permalink | absLangURL }}
{{- $active := eq $menu_item_url $page_url -}}
{{- $activeClass := cond $active "active" "" -}}
<!-- Home link [&.active]:text-bold [&.active]:text-black/90 dark:[&.active]:text-neutral-300-->
<li
class="my-4 pl-2 lg:my-0 lg:pl-2 lg:pr-1"
data-te-nav-item-ref>
<a
class="lg:px-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white {{ $activeClass }}"
aria-current="page"
href="{{ .URL | relLangURL }}"
data-te-nav-link-ref
>{{- .Name -}}</a
>
</li>
<header id="site-header" class="header">
<nav class="navbar px-3 flex justify-left">
<div class="order-0 h-100">
<!-- Brand -->
<a class="navbar-brand" href="{{ site.Home.RelPermalink }}">
{{- $logo_filename := site.Params.header.navbar.logo.filename -}}
{{ with $logo_filename }}
{{- $logo:= resources.Get (path.Join "media" $logo_filename) -}}
{{ with $logo }}
{{ $logoExt := path.Ext . }}
{{ if eq $logoExt `.svg` }}
{{- $logo.Content | safeHTML -}}
{{else}}
{{ $logo_img := ($logo.Process "Resize x36 webp") }}
<img
fetchpriority="high"
decoding="async"
class=""
width="{{ $logo_img.Width }}"
height="{{ $logo_img.Height }}"
src="{{ $logo_img.RelPermalink }}"
alt="{{ site.Title }}" />
{{end}}
{{ else }}
{{ warnf "Logo `%s` not found in `assets/media/` folder" $logo_filename }}
{{end}}
{{ end }}
{{ if $show_search }}
<li class="my-4 pl-2 lg:my-0 lg:pl-2 lg:pr-1">
<a
class="lg:px-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white"
aria-current="page"
href="#"
id="search_toggle"
>{{- i18n "search" -}}</a
>
</li>
{{ end }}
{{ $show_theme_chooser := site.Params.header.navbar.show_theme_chooser | default true }}
{{ if $show_theme_chooser }}
<li class="lg:px-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white">
<button class="theme-toggle mt-1" accesskey="t" title="">
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="dark:hidden">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
<svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class=" dark:block [&:not(dark)]:hidden">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
</li>
{{ end }}
{{ $show_translations := site.Params.header.navbar.show_translations | default true }}
{{ if .IsTranslated | and $show_translations }}
<li class="lg:px-2 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white">
{{- partial "components/language-chooser.html" (dict "page" .) -}}
</li>
{{ end }}
</ul>
{{ with site.Params.header.navbar.logo.text }}{{.}}{{end}}
</a>
</div>
</div>
</nav>
<!-- Mobile menu -->
<input id="nav-toggle" type="checkbox" class="hidden" />
<label
for="nav-toggle"
class="order-3 cursor-pointer flex items-center lg:hidden text-dark dark:text-white lg:order-1">
<svg id="show-button" class="h-6 fill-current block" viewBox="0 0 20 20">
<title>Open Menu</title>
<path d="M0 3h20v2H0V3z m0 6h20v2H0V9z m0 6h20v2H0V0z"></path>
</svg>
<svg id="hide-button" class="h-6 fill-current hidden" viewBox="0 0 20 20">
<title>Close Menu</title>
<polygon
points="11 9 22 9 22 11 11 11 11 22 9 22 9 11 -2 11 -2 9 9 9 9 -2 11 -2"
transform="rotate(45 10 10)"></polygon>
</svg>
</label>
<!-- /Mobile menu -->
<!-- Main menu -->
<ul
id="nav-menu"
class="navbar-nav order-3 hidden lg:flex w-full pb-6 lg:order-1 lg:w-auto lg:space-x-2 lg:pb-0 xl:space-x-8 justify-left">
{{ $currentPage := . }}
{{ range site.Menus.main }}
{{ $menuURL := .URL | absLangURL }}
{{ $pageURL:= $currentPage.Permalink | absLangURL }}
{{ $active := eq $menuURL $pageURL }}
{{ if .HasChildren }}
<li class="nav-item nav-dropdown group relative">
<span
class="nav-link {{ range .Children }}
{{ $childURL := .URL | absLangURL }}
{{ $active := eq $childURL $pageURL }}
{{ if $active }}active{{ end }}
{{ end }} inline-flex items-center">
{{ .Name }}
<svg class="h-4 w-4 fill-current inline-block" viewBox="0 0 20 20">
<path
d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z" />
</svg>
</span>
<ul
class="nav-dropdown-list lg:group-hover:visible lg:group-hover:opacity-100">
{{ range .Children }}
{{ $childURL := .URL | absLangURL }}
{{ $active := eq $childURL $pageURL }}
{{ $url := "" }}
{{- if findRE `^#` .URL -}}
{{- if not $.IsHome -}}
{{- $url = site.Home.RelPermalink -}}
{{- end }}
{{- $url = .URL -}}
{{- else -}}
{{- $url = .URL | relLangURL -}}
{{- end -}}
<li class="nav-dropdown-item">
<a
class="nav-dropdown-link {{ if $active }}active{{- end -}}"
{{ if findRE `^http` .URL }}
target="_blank" rel="noopener"
{{ end }}
href="{{$url}}">
{{ .Name }}
</a>
</li>
{{ end }}
</ul>
</li>
{{ else }}
{{ $url := "" }}
{{- if findRE `^#` .URL -}}
{{- if not $.IsHome -}}
{{- $url = site.Home.RelPermalink -}}
{{- end }}
{{- $url = .URL -}}
{{- else -}}
{{- $url = .URL | relLangURL -}}
{{- end -}}
<li class="nav-item">
<a
class="nav-link {{ if $active }}active{{- end -}}"
{{ if findRE `^http` .URL }}
target="_blank" rel="noopener"
{{ end }}
href="{{$url}}"
>{{ .Name }}</a
>
</li>
{{ end }}
{{ end }}
{{ if site.Params.header.navbar.button.enable }}
<li class="mt-4 inline-block lg:hidden">
<a
class=""
href="{{ site.Params.header.navbar.button.url | relLangURL }}">
{{ site.Params.header.navbar.button.text }}
</a>
</li>
{{ end }}
</ul>
<div class="order-1 ml-auto flex items-center md:order-2 lg:ml-0">
{{/* Show site search? */}}
{{ $show_search := site.Params.header.navbar.show_search | default false }}
{{ with $show_search }}
<button
aria-label="search"
class="text-black hover:text-primary inline-block px-3 text-xl dark:text-white"
id="search_toggle">
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512" fill="currentColor"><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"/></svg>
</button>
{{ end }}
{{ $show_theme_chooser := site.Params.header.navbar.show_theme_chooser | default true }}
{{ if $show_theme_chooser }}
<div class="px-3 text-black hover:text-primary-700 dark:text-white dark:hover:text-primary-300
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white">
<button class="theme-toggle mt-1" accesskey="t" title="">
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="dark:hidden">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
<svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="18" viewBox="0 0 24 24"
fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class=" dark:block [&:not(dark)]:hidden">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</button>
</div>
{{ end }}
{{ $show_translations := site.Params.header.navbar.show_translations | default true }}
{{ if .IsTranslated | and $show_translations }}
<div class="pl-1 mr-5 text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200
[&.active]:font-bold [&.active]:text-black/90 dark:[&.active]:text-white">
{{- partial "components/language-chooser.html" (dict "page" .) -}}
</div>
{{ end }}
<!-- CTA button -->
{{ if site.Params.header.navbar.button.enable }}
<a
href="{{ site.Params.header.navbar.button.url | relLangURL }}"
class="inline-block rounded border px-5 py-2 font-semibold transition
md:ml-4 px-4 py-1.5 text-sm
border-black hover:bg-black dark:hover:bg-white dark:hover:text-black hover:text-white dark:border-white dark:text-white dark:hover:bg-white
hidden lg:inline-block">
{{ site.Params.header.navbar.button.text }}
</a>
{{ end }}
</div>
</nav>
</header>
{{ if $show_search }}
<div id="search" class="hidden p-3"></div>
<div id="search" class="hidden p-3"></div>
{{ end }}
<script>
function toggleNavbar(collapseID){
document.getElementById(collapseID).classList.toggle("hidden");
document.getElementById(collapseID).classList.toggle("flex");
}
</script>

View file

@ -1,3 +1,55 @@
{{/* Show site search? */}}
{{ $show_search := site.Params.header.navbar.show_search | default false }}
{{ if $show_search }}
{{ $pf_css := resources.Get "dist/pagefind/pagefind-ui.css" }}
{{ $pf_css = $pf_css | resources.Fingerprint "sha256" }}
<link type="text/css" rel="stylesheet" href="{{ $pf_css.RelPermalink }}" integrity="{{ $pf_css.Data.Integrity }}" />
{{ $pf_js := resources.Get "dist/pagefind/pagefind-ui.js" }}
{{ $pf_js = $pf_js | resources.Fingerprint "sha256" }}
<script src="{{ $pf_js.RelPermalink }}" integrity="{{ $pf_js.Data.Integrity }}"></script>
<style>
html.dark {
--pagefind-ui-primary: #eeeeee;
--pagefind-ui-text: #eeeeee;
--pagefind-ui-background: #152028;
--pagefind-ui-border: #152028;
--pagefind-ui-tag: #152028;
}
</style>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({ element: "#search", showSubResults: true });
});
document.addEventListener('DOMContentLoaded', () => {
let element = document.getElementById('search');
let trigger = document.getElementById('search_toggle');
if (trigger) {
trigger.addEventListener('click', () => {
element.classList.toggle('hidden');
element.querySelector("input").value = ""
element.querySelector("input").focus()
if (!element.classList.contains('hidden')) {
let clear_trigger = document.querySelector('.pagefind-ui__search-clear');
if (clear_trigger && !clear_trigger.hasAttribute('listenerOnClick')) {
clear_trigger.setAttribute('listenerOnClick', 'true');
clear_trigger.addEventListener('click', () => {
element.classList.toggle('hidden');
});
}
}
});
}
});
</script>
{{ end }}
{{/* Mermaid */}}
{{ if (.Page.Store.Get "has_mermaid") }}
{{ $mermaid_js := resources.Get "dist/lib/mermaid/mermaid.min.js" }}

View file

@ -262,7 +262,8 @@
{{ $js_academic := $js_academic | resources.Minify }}
{{- $js_theme := resources.Get "js/wowchemy-theme.js" | resources.Minify -}}
{{- $js_lang := resources.Get "js/hb-i18n.js" | resources.Minify -}}
{{ $js_bundle := slice $js_bundle_head $js_academic $js_theme $js_lang | resources.Concat (printf "js/wowchemy-%s.min.js" .Lang) }}
{{- $js_nav := resources.Get "js/hb-nav.js" | resources.Minify -}}
{{ $js_bundle := slice $js_bundle_head $js_academic $js_theme $js_lang $js_nav | resources.Concat (printf "js/hugo-blox-%s.min.js" .Lang) }}
{{- if hugo.IsProduction -}}
{{ $js_bundle = $js_bundle | fingerprint "sha256" }}
{{- end -}}

View file

@ -1,2 +1,2 @@
<div class="mt-16 sm:mt-20">
<div class="flex max-w-3xl flex-col space-y-16">
<div class="mt-16 sm:mt-20 w-fit">
<div class="flex max-w-3xl flex-col space-y-16">