<div class="menu-placeholder"></div>
<nav id="main-menu-bar" class="navbar is-primary">
    <div class="container">
        <div class="navbar-brand">
            <a href="{{ .Site.Home.Permalink }}" class="navbar-item"><patek-logo>Pátek</patek-logo></a>
            <div class="navbar-burger" id="main-menu-burger" onclick="document.querySelectorAll('#main-menu, #main-menu-burger').forEach(function (value) { value.classList.toggle('is-active') })">
                <span aria-hidden="true"></span>
                <span aria-hidden="true"></span>
                <span aria-hidden="true"></span>
            </div>
        </div>
        <div class="navbar-menu is-marginless" id="main-menu">
            <div class="navbar-start">
                {{ $currentPage := . }}
                {{ range .Site.Menus.main }}
                    {{ if .HasChildren }}
                        <div class="navbar-item has-dropdown is-hoverable {{ if $currentPage.HasMenuCurrent "main" . }}is-hovered{{ end }}">
                            {{- $url := urls.Parse .URL -}}
                            {{ if ne .URL "" }}<a class="navbar-link" href="{{- .URL -}}"{{ if $url.Host }} target="_blank"{{ end }}>{{ else }}<span class="navbar-link">{{ end }}
                            {{- .Name -}}
                            {{ if eq .URL ""}}</span>{{ else }}</a>{{ end }}
                            <div class="navbar-dropdown">
                                {{ range .Children }}
                                    {{- $url := urls.Parse .URL -}}
                                    {{ if ne .URL "" }}<a href="{{ .URL }}" class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-hovered{{ end }}"{{ if $url.Host }} target="_blank"{{ end }}>{{ else }}<span class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-hovered{{ end }}">{{ end }}
                                    {{- .Name -}}
                                    {{ if eq .URL "" }}</span>{{ else }}</a>{{ end }}
                                {{ end }}
                            </div>
                        </div>
                    {{ else }}
                        {{- $url := urls.Parse .URL -}}
                        {{ if ne .URL "" }}<a href="{{ .URL }}" class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-hovered{{ end }}"{{ if $url.Host }} target="_blank"{{ end }}>{{ else }}<span class="navbar-item {{ if $currentPage.IsMenuCurrent "main" . }}is-hovered{{ end }}">{{ end }}
                        {{- .Name -}}
                        {{ if eq .URL "" }}</span>{{ else }}</a>{{ end }}
                    {{ end }}
                {{ end }}
            </div>
            <div class="navbar-end">
                <div class="navbar-item has-dropdown is-hoverable">
                    <span class="navbar-link">{{ .Site.Language.LanguageName }}</span>
                    <div class="navbar-dropdown">
                        {{ range .Translations }}
                            <a href="{{ .Permalink }}" class="navbar-item"> {{ .Language.LanguageName }}</a>
                        {{ end }}
                    </div>
                </div>
            </div>
        </div>
    </div>
</nav>
