2023-08-20 20:34:01 +01:00
|
|
|
{{- $logoPath := .Site.Params.navbar.logo.path | default "images/logo.svg" -}}
|
|
|
|
{{- $logoLink := .Site.Params.navbar.logo.link | default .Site.Home.RelPermalink -}}
|
|
|
|
{{- $logoWidth := .Site.Params.navbar.logo.width | default "20" -}}
|
|
|
|
{{- $logoHeight := .Site.Params.navbar.logo.height | default "20" -}}
|
|
|
|
{{- $logoDarkPath := .Site.Params.navbar.logo.dark | default $logoPath -}}
|
|
|
|
|
2023-09-20 23:36:00 +01:00
|
|
|
{{- $navWidth := "max-w-[90rem]" -}}
|
|
|
|
{{- with .Site.Params.navbar.width -}}
|
|
|
|
{{ if eq . "normal" -}}
|
|
|
|
{{ $navWidth = "max-w-screen-xl" -}}
|
|
|
|
{{ else if eq . "full" -}}
|
|
|
|
{{ $navWidth = "max-w-full" -}}
|
|
|
|
{{ end -}}
|
|
|
|
{{- end -}}
|
2023-08-20 20:34:01 +01:00
|
|
|
|
2023-09-13 05:02:38 -04:00
|
|
|
<div class="nav-container sticky top-0 z-20 w-full bg-transparent print:hidden">
|
|
|
|
<div class="nav-container-blur pointer-events-none absolute z-[-1] h-full w-full bg-white dark:bg-dark shadow-[0_2px_4px_rgba(0,0,0,.02),0_1px_0_rgba(0,0,0,.06)] contrast-more:shadow-[0_0_0_1px_#000] dark:shadow-[0_-1px_0_rgba(255,255,255,.1)_inset] contrast-more:dark:shadow-[0_0_0_1px_#fff]"></div>
|
2023-07-25 23:27:01 +01:00
|
|
|
|
2023-09-20 23:36:00 +01:00
|
|
|
<nav class="mx-auto flex items-center justify-end gap-2 h-16 px-6 {{ $navWidth }}">
|
2023-08-20 20:34:01 +01:00
|
|
|
<a class="flex items-center hover:opacity-75 ltr:mr-auto rtl:ml-auto" href="{{ $logoLink }}">
|
2023-08-23 01:00:36 +01:00
|
|
|
{{- if (.Site.Params.navbar.displayLogo | default true) }}
|
2023-09-14 03:17:28 -04:00
|
|
|
<img class="block dark:hidden" src="{{ $logoPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
|
|
|
|
<img class="hidden dark:block" src="{{ $logoDarkPath | relURL }}" alt="{{ .Site.Title }}" height="{{ $logoHeight }}" width="{{ $logoWidth }}" />
|
2023-08-23 01:00:36 +01:00
|
|
|
{{- end }}
|
|
|
|
{{- if (.Site.Params.navbar.displayTitle | default true) }}
|
2023-08-21 01:00:52 +01:00
|
|
|
<span class="mx-2 font-extrabold inline select-none" title="{{ .Site.Title }}">{{- .Site.Title -}}</span>
|
2023-08-23 01:00:36 +01:00
|
|
|
{{- end }}
|
2023-07-25 23:27:01 +01:00
|
|
|
</a>
|
|
|
|
|
2023-08-04 01:11:31 +01:00
|
|
|
{{- $currentPage := . -}}
|
|
|
|
{{- range .Site.Menus.main -}}
|
2023-08-06 15:23:37 +01:00
|
|
|
{{- if eq .Params.type "search" -}}
|
2023-08-14 21:56:26 +01:00
|
|
|
{{- partial "search.html" (dict "params" .Params) -}}
|
2023-08-06 15:23:37 +01:00
|
|
|
{{- else -}}
|
2023-08-14 21:56:26 +01:00
|
|
|
{{- $external := strings.HasPrefix .URL "http" -}}
|
|
|
|
{{/* Display icon menu item */}}
|
2023-08-06 15:23:37 +01:00
|
|
|
{{- if .Params.icon -}}
|
2023-08-23 01:00:36 +01:00
|
|
|
<a class="p-2 text-current" {{ if $external }}target="_blank" rel="noreferer"{{ end }} href="{{ .URL | relLangURL }}" title="{{ or (T .Identifier) .Name | safeHTML }}">
|
2023-08-14 21:56:26 +01:00
|
|
|
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" "height=24") -}}
|
2023-08-21 01:00:52 +01:00
|
|
|
<span class="sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span>
|
2023-08-06 15:23:37 +01:00
|
|
|
</a>
|
|
|
|
{{- else -}}
|
2023-08-14 21:56:26 +01:00
|
|
|
{{- $active := or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) -}}
|
|
|
|
{{- $activeClass := cond $active "font-medium" "text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200" -}}
|
2023-08-06 15:23:37 +01:00
|
|
|
<a
|
2023-08-23 01:00:36 +01:00
|
|
|
title="{{ or (T .Identifier) .Name | safeHTML }}"
|
2023-08-21 01:00:52 +01:00
|
|
|
href="{{ .URL | relLangURL }}"
|
2023-08-06 15:23:37 +01:00
|
|
|
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
|
2023-08-14 21:56:26 +01:00
|
|
|
class="text-sm contrast-more:text-gray-700 contrast-more:dark:text-gray-100 relative -ml-2 hidden whitespace-nowrap p-2 md:inline-block {{ $activeClass }}"
|
2023-08-06 15:23:37 +01:00
|
|
|
>
|
2023-08-21 01:00:52 +01:00
|
|
|
<span class="text-center">{{ or (T .Identifier) .Name | safeHTML }}</span>
|
2023-08-06 15:23:37 +01:00
|
|
|
</a>
|
|
|
|
{{- end -}}
|
2023-08-14 21:56:26 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- end -}}
|
2023-08-06 15:23:37 +01:00
|
|
|
|
|
|
|
|
2023-08-21 01:00:52 +01:00
|
|
|
<button type="button" aria-label="Menu" class="hamburger-menu -mr-2 rounded p-2 active:bg-gray-400/20 md:hidden">
|
2023-08-15 21:55:14 +01:00
|
|
|
{{- partial "utils/icon.html" (dict "name" "hamburger-menu" "attributes" "height=24") -}}
|
2023-08-06 15:23:37 +01:00
|
|
|
</button>
|
2023-07-25 23:27:01 +01:00
|
|
|
</nav>
|
|
|
|
</div>
|