mirror of
https://github.com/imfing/hextra.git
synced 2025-06-20 07:11:26 -04:00
feat: add option to set default theme and hide toggle button (#146)
resolves #135 Light / dark theme can be configured via: ```yaml theme: # light | dark | system default: system displayToggle: true ```
This commit is contained in:
@ -34,17 +34,21 @@
|
||||
{{ end -}}
|
||||
</div>
|
||||
{{/* Hide theme switch when sidebar is disabled */}}
|
||||
{{ $switchesClass := cond $disableSidebar "md:hidden" "" }}
|
||||
<div class="{{ $switchesClass }} {{ with site.IsMultiLingual }}justify-end{{ end }} sticky bottom-0 bg-white dark:bg-dark mx-4 py-4 shadow-[0_-12px_16px_#fff] flex items-center gap-2 dark:border-neutral-800 dark:shadow-[0_-12px_16px_#111] contrast-more:border-neutral-400 contrast-more:shadow-none contrast-more:dark:shadow-none border-t" data-toggle-animation="show">
|
||||
{{- with site.IsMultiLingual }}
|
||||
{{ partial "language-switch" (dict "context" $context "grow" true) }}
|
||||
{{ partial "theme-toggle" (dict "hideLabel" true) }}
|
||||
{{ else }}
|
||||
<div class="flex grow flex-col">
|
||||
{{ partial "theme-toggle" }}
|
||||
</div>
|
||||
{{ end -}}
|
||||
</div>
|
||||
{{ $switchesClass := cond $disableSidebar "md:hidden" "" -}}
|
||||
{{ $displayThemeToggle := (site.Params.theme.displayToggle | default true) -}}
|
||||
|
||||
{{ if or site.IsMultiLingual $displayThemeToggle }}
|
||||
<div class="{{ $switchesClass }} {{ with site.IsMultiLingual }}justify-end{{ end }} sticky bottom-0 bg-white dark:bg-dark mx-4 py-4 shadow-[0_-12px_16px_#fff] flex items-center gap-2 dark:border-neutral-800 dark:shadow-[0_-12px_16px_#111] contrast-more:border-neutral-400 contrast-more:shadow-none contrast-more:dark:shadow-none border-t" data-toggle-animation="show">
|
||||
{{- with site.IsMultiLingual -}}
|
||||
{{- partial "language-switch" (dict "context" $context "grow" true) -}}
|
||||
{{- with $displayThemeToggle }}{{ partial "theme-toggle" (dict "hideLabel" true) }}{{ end -}}
|
||||
{{- else -}}
|
||||
{{- with $displayThemeToggle -}}
|
||||
<div class="flex grow flex-col">{{ partial "theme-toggle" }}</div>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
</aside>
|
||||
|
||||
{{- define "sidebar-main" -}}
|
||||
|
Reference in New Issue
Block a user