hugo-theme-zzo/layouts/partials/navbar/nav-menu.html

32 lines
1.6 KiB
HTML

<div class="navbar__menu">
{{ if $.Site.Params.enableAppbarSearchIcon }}
{{ partial "navbar/search-icon" . }}
{{ end }}
{{ if $.Site.Params.enableAppbarLangIcon }}
{{ partial "navbar/language-icon" . }}
{{ end }}
{{ partial "navbar/select-theme" . }}
{{ $current := . }}
{{ range .Site.Menus.main }}
{{ $active := or ($current.IsMenuCurrent "main" .) ($current.HasMenuCurrent "main" .) }}
{{ $active = or $active (eq .Name $current.Title) }}
{{ $active = or $active (eq (lower .URL) (lower $current.Title)) }}
{{ $active = or $active (eq (lower .URL) (lower $current.Type)) }}
{{ if .HasChildren }}
<div class="navbar__dropdown navbar__slide-down" data-ani="{{ $.Site.Params.enableUiAnimation | default "true" }}">
<a href="{{ .URL | relLangURL }}" class="navbar__menu-item {{ if $active }}active{{ end }}"
dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">
{{ safeHTML .Name }}
{{ partial "svgs/arrow/keyboard-arrow-down.svg" (dict "width" 18 "height" 18) }}
</a>
<div class="navbar__dropdown--content">
{{ range .Children }}
<a href="{{ .URL | relLangURL }}" class="navbar__dropdown--item" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}">{{ safeHTML .Name }}</a>
{{ end }}
</div>
</div>
{{ else }}
<a href="{{ .URL | relLangURL }}" class="navbar__menu-item navbar__slide-down {{ if $active }}active{{ end }}" dir="{{ if ne ($.Param "languagedir") "rtl" }}ltr{{ else }}rtl{{ end }}" data-ani="{{ $.Site.Params.enableUiAnimation | default "true" }}">{{ safeHTML .Name }}</a>
{{ end }}
{{ end }}
</div>