forked from drowl87/hextra_mirror
chore: add back mobile nav
This commit is contained in:
parent
1048ee47d7
commit
1e1d1c8716
@ -16,14 +16,15 @@
|
|||||||
<div class="hextra-scrollbar overflow-y-auto overflow-x-hidden p-4 grow md:h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
|
<div class="hextra-scrollbar overflow-y-auto overflow-x-hidden p-4 grow md:h-[calc(100vh-var(--navbar-height)-var(--menu-height))]">
|
||||||
<ul class="flex flex-col gap-1 md:hidden">
|
<ul class="flex flex-col gap-1 md:hidden">
|
||||||
{{/* Mobile Navigation */}}
|
{{/* Mobile Navigation */}}
|
||||||
{{/* TODO: add back mobile navigation tree */}}
|
{{ $treeMobile := partialCached "sidebar/section-tree" site.Home site.Home }}
|
||||||
|
{{ template "sidebar-render-tree" (dict "context" site.Home "page" $context "tree" ($treeMobile | unmarshal)) }}
|
||||||
{{ partialCached "sidebar/extra" $context }}
|
{{ partialCached "sidebar/extra" $context }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{/* Sidebar on large screen */}}
|
{{/* Sidebar on large screen */}}
|
||||||
<ul class="flex flex-col gap-1 max-md:hidden">
|
<ul class="flex flex-col gap-1 max-md:hidden">
|
||||||
{{ $tree := partialCached "sidebar/section-tree" $navRoot $navRoot }}
|
{{ $tree := partialCached "sidebar/section-tree" $navRoot $navRoot }}
|
||||||
{{ partial "sidebar/render-tree" (dict "context" $navRoot "page" $context "tree" ($tree | unmarshal)) }}
|
{{ template "sidebar-render-tree" (dict "context" $navRoot "page" $context "tree" ($tree | unmarshal)) }}
|
||||||
{{ partialCached "sidebar/extra" $context }}
|
{{ partialCached "sidebar/extra" $context }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -31,7 +32,7 @@
|
|||||||
{{ partial "sidebar/switches" (dict "context" $context "disableSidebar" $disableSidebar) }}
|
{{ partial "sidebar/switches" (dict "context" $context "disableSidebar" $disableSidebar) }}
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
{{- define "partials/sidebar/render-tree" -}}
|
{{- define "sidebar-render-tree" -}}
|
||||||
{{- $context := .context -}}
|
{{- $context := .context -}}
|
||||||
{{- $page := .page -}}
|
{{- $page := .page -}}
|
||||||
{{- $pageLink := .page.RelPermalink -}}
|
{{- $pageLink := .page.RelPermalink -}}
|
||||||
@ -39,15 +40,15 @@
|
|||||||
{{- $active := eq $pageLink .link -}}
|
{{- $active := eq $pageLink .link -}}
|
||||||
{{- $shouldOpen := or (.open) (hasPrefix $pageLink .link) $active | default true }}
|
{{- $shouldOpen := or (.open) (hasPrefix $pageLink .link) $active | default true }}
|
||||||
<li class="{{ if $shouldOpen }}open{{ end }}">
|
<li class="{{ if $shouldOpen }}open{{ end }}">
|
||||||
{{- partial "sidebar/link" (dict "context" . "active" $active "title" .title "link" .link) -}}
|
{{- template "sidebar-item-link" (dict "context" . "active" $active "title" .title "link" .link) -}}
|
||||||
{{- if .section -}}
|
{{- if .section -}}
|
||||||
{{- partial "sidebar/render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}}
|
{{- template "sidebar-render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "partials/sidebar/render-tree-branch" -}}
|
{{- define "sidebar-render-tree-branch" -}}
|
||||||
{{- $context := .context -}}
|
{{- $context := .context -}}
|
||||||
{{- $page := .page -}}
|
{{- $page := .page -}}
|
||||||
{{- $entry := .entry -}}
|
{{- $entry := .entry -}}
|
||||||
@ -59,9 +60,9 @@
|
|||||||
{{- $active := eq $pageLink .link -}}
|
{{- $active := eq $pageLink .link -}}
|
||||||
{{- $shouldOpen := or (.open) (hasPrefix $pageLink .link) $active | default true }}
|
{{- $shouldOpen := or (.open) (hasPrefix $pageLink .link) $active | default true }}
|
||||||
<li class="flex flex-col gap-1 {{ if $shouldOpen }}open{{ end }}">
|
<li class="flex flex-col gap-1 {{ if $shouldOpen }}open{{ end }}">
|
||||||
{{- partial "sidebar/link" (dict "context" . "active" $active "title" .title "link" .link) -}}
|
{{- template "sidebar-item-link" (dict "context" . "active" $active "title" .title "link" .link) -}}
|
||||||
{{- if .section -}}
|
{{- if .section -}}
|
||||||
{{- partial "sidebar/render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}}
|
{{- template "sidebar-render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</li>
|
</li>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
@ -75,7 +76,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{- define "partials/sidebar/link" -}}
|
{{- define "sidebar-item-link" -}}
|
||||||
{{- $external := strings.HasPrefix .link "http" -}}
|
{{- $external := strings.HasPrefix .link "http" -}}
|
||||||
<a
|
<a
|
||||||
class="flex items-center justify-between gap-2 cursor-pointer rounded px-2 py-1.5 text-sm transition-colors [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] [word-break:break-word]
|
class="flex items-center justify-between gap-2 cursor-pointer rounded px-2 py-1.5 text-sm transition-colors [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] [word-break:break-word]
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
<span class="cursor-default">{{ $name }}</span>
|
<span class="cursor-default">{{ $name }}</span>
|
||||||
</li>
|
</li>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<li>{{ partial "sidebar/link" (dict "active" false "title" $name "link" (.URL | relLangURL)) }}</li>
|
<li>{{ template "sidebar-item-link" (dict "active" false "title" $name "link" (.URL | relLangURL)) }}</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user