mirror of
https://github.com/imfing/hextra.git
synced 2025-08-24 09:16:35 -04:00
feat(navbar): language switcher (#760)
* feat(navbar): language switcher * docs: add language-switch * chore: just for the demo * fix: drop conflicting CSS * fix: use constant * fix: pre-existing bug with rtl on mobile * docs: add comment to explain the algo * chore: more readable algo * review Co-authored-by: Xin <5097752+imfing@users.noreply.github.com> * feat: different icons * feat: icon as param * fix: inconsitency with rtl * fix: render inside the sidebar * chore: remove the demo --------- Co-authored-by: Xin <5097752+imfing@users.noreply.github.com>
This commit is contained in:

committed by
GitHub

parent
b2ff662c8e
commit
363b1e50ff
@@ -7,6 +7,7 @@
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $page := . -}}
|
||||
{{- $iconHeight := 24 -}}
|
||||
|
||||
<div class="hextra-nav-container hx:sticky hx:top-0 hx:z-20 hx:w-full hx:bg-transparent hx:print:hidden">
|
||||
@@ -39,6 +40,8 @@
|
||||
</a>
|
||||
{{- else if eq .Params.type "theme-toggle" -}}
|
||||
{{- partial "theme-toggle.html" (dict "iconHeight" $iconHeight "class" "hx:p-2" "hideLabel" (not .Params.label)) -}}
|
||||
{{- else if eq .Params.type "language-switch" -}}
|
||||
{{- partial "language-switch" (dict "context" $page "grow" false "hideLabel" (not .Params.label) "iconName" (.Params.icon | default "translate") "iconHeight" $iconHeight "location" "top" "class" "hx:p-2") -}}
|
||||
{{- else -}}
|
||||
{{- $active := or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) -}}
|
||||
{{- $activeClass := cond $active "hx:font-medium" "hx:text-gray-600 hx:hover:text-gray-800 hx:dark:text-gray-400 hx:dark:hover:text-gray-200" -}}
|
||||
|
Reference in New Issue
Block a user