congo/layouts/partials/header/basic.html

113 lines
5.2 KiB
HTML
Raw Normal View History

2023-12-26 00:56:32 +00:00
<header class="py-6 font-semibold text-neutral-900 print:hidden sm:py-10 dark:text-neutral">
2022-11-10 00:32:43 +00:00
<nav class="flex items-start justify-between sm:items-center">
{{/* Site logo/title */}}
2022-11-10 00:32:43 +00:00
<div class="flex flex-row items-center">
{{ partial "logo.html" . }}
</div>
{{/* Main menu */}}
{{ if or .Site.Menus.main (.Site.Params.enableSearch | default false) }}
2023-12-26 00:56:32 +00:00
<ul class="flex list-none flex-col text-end sm:flex-row">
{{ if .Site.Menus.main }}
{{ range .Site.Menus.main }}
{{ if and (eq .Params.action "locale") (or (not page.IsTranslated) (not site.IsMultiLingual)) }}
{{ continue }}
{{ end }}
<li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0.5">
{{ if eq .Params.action "search" }}
{{ $.Scratch.Add "searchCount" 1 }}
{{ if $.Site.Params.enableSearch | default false }}
<button
id="search-button-{{ $.Scratch.Get "searchCount" }}"
title="{{ .Title | default (i18n "search.open_button_title") }}"
>
{{ with .Params.icon | default "search" }}
<span
2023-12-26 00:56:32 +00:00
class="group-dark:hover:text-primary-400 transition-colors group-hover:text-primary-600"
>
2023-06-01 11:09:31 +00:00
{{- partial "icon.html" . -}}
</span>
2023-06-01 11:09:31 +00:00
{{- end -}}{{- if .Params.showName | default true -}}
<span
class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2"
>{{ .Name | markdownify | emojify }}</span
>
{{ end }}
</button>
{{ end }}
{{ else if eq .Params.action "appearance" }}
{{ $.Scratch.Add "switchCount" 1 }}
<button
id="appearance-switcher-{{ $.Scratch.Get "switchCount" }}"
type="button"
aria-label="appearance switcher"
>
<span
2023-12-26 00:56:32 +00:00
class="group-dark:hover:text-primary-400 inline transition-colors group-hover:text-primary-600 dark:hidden"
title="{{ i18n "footer.dark_appearance" }}"
>
{{ with .Params.icon | default "moon" }}
2023-06-01 11:09:31 +00:00
{{- partial "icon.html" . -}}
{{- end -}}
{{- if .Params.showName | default true -}}
<span
class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2"
>{{ .Name | markdownify | emojify }}</span
>
{{ end }}
</span>
<span
2023-12-26 00:56:32 +00:00
class="group-dark:hover:text-primary-400 hidden transition-colors group-hover:text-primary-600 dark:inline"
title="{{ i18n "footer.light_appearance" }}"
>
{{ with .Params.icon | default "sun" }}
{{ partial "icon.html" . }}
{{ end }}
{{ if .Params.showName | default true }}
<span
class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2"
>{{ .Name | markdownify | emojify }}</span
>
{{ end }}
</span>
</button>
{{ else if eq .Params.action "locale" }}
{{ $.Scratch.Add "localeCount" 1 }}
{{ partial "translations.html" . }}
{{ else }}
<a
href="{{ .URL }}"
title="{{ .Title }}"
{{ with .Params.target }}target="{{ . }}"{{ end }}
>{{ with .Params.icon }}
<span
2023-12-26 00:56:32 +00:00
class="group-dark:hover:text-primary-400 transition-colors group-hover:text-primary-600"
>
2023-06-01 11:09:31 +00:00
{{- partial "icon.html" . -}}
</span>
2023-06-01 11:09:31 +00:00
{{- end -}}{{- if .Params.showName | default true -}}
<span
class="decoration-primary-500 group-hover:underline group-hover:decoration-2 group-hover:underline-offset-2"
>{{ .Name | markdownify | emojify }}</span
>
{{ end }}</a
>
{{ end }}
</li>
{{ end }}
{{ if and ($.Site.Params.enableSearch | default false) (eq ($.Scratch.Get "searchCount") 0) }}
2023-12-26 00:56:32 +00:00
<li class="group mb-1 sm:mb-0 sm:me-7 sm:last:me-0">
<button id="search-button-m0" title="{{ i18n "search.open_button_title" }}">
<span
2023-12-26 00:56:32 +00:00
class="group-dark:hover:text-primary-400 transition-colors group-hover:text-primary-600"
>
{{ partial "icon.html" "search" }}
</span>
</button>
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}
</nav>
</header>