chore: add displayPlaceholder option to sidebar

This commit is contained in:
Xin
2023-08-24 22:29:53 +01:00
parent d14091cd81
commit 97f31e92a7
5 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,9 @@
{{- $context := .context -}}
{{- $disableSidebar := .disableSidebar | default false -}}
{{- $sidebarClass := cond $disableSidebar "md:hidden xl:block" "md:sticky" -}}
{{- $displayPlaceholder := .displayPlaceholder | default false -}}
{{- $sidebarClass := cond $disableSidebar (cond $displayPlaceholder "md:hidden xl:block" "md:hidden") "md:sticky" -}}
{{- $navRoot := cond (eq site.Home.Type "docs") site.Home $context.FirstSection -}}
{{- $navPages := union $navRoot.RegularPages $navRoot.Sections -}}
@ -20,8 +23,8 @@
</ul>
<!-- Sidebar on large screen -->
{{- if $disableSidebar }}
<div class="max-xl:hidden h-0 w-64 shrink-0"></div>
{{- if $disableSidebar -}}
{{- if $displayPlaceholder }}<div class="max-xl:hidden h-0 w-64 shrink-0"></div>{{ end -}}
{{ .context.Scratch.Set "enableFooterSwitches" true }}
{{- else -}}
<ul class="flex flex-col gap-1 max-md:hidden">