mirror of
https://github.com/imfing/hextra.git
synced 2025-08-23 10:07:11 -04:00
fix(language-switch): manage icon menu item after the language switcher (#772)
* fix(language-switch): manage icon menu item after the language switcher
* Just for the demo will be reverted/removed when the PR will be approved
* chore: add a warning when an icon menu has no URL
* chore: trim the comment
* fix: comment
* Revert "Just for the demo will be reverted/removed when the PR will be approved"
This reverts commit 09cc9fe393
.
This commit is contained in:

committed by
GitHub

parent
f4d75a4e5b
commit
5b6f4218be
@@ -31,17 +31,18 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
{{/* Display icon menu item */}}
|
{{- if eq .Params.type "theme-toggle" -}}
|
||||||
{{- if .Params.icon -}}
|
{{- partial "theme-toggle.html" (dict "iconHeight" $iconHeight "hideLabel" (not .Params.label) "iconHeight" $iconHeight "location" "top" "class" "hx:p-2") -}}
|
||||||
|
{{- 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 if .Params.icon -}}
|
||||||
|
{{- /* Display icon menu item */ -}}
|
||||||
|
{{- if not $link -}}{{ warnf "Icon menu item '%s' has no URL" .Name }}{{- end -}}
|
||||||
{{- $rel := cond (eq .Params.icon "mastodon") "noreferrer me" "noreferrer" }}
|
{{- $rel := cond (eq .Params.icon "mastodon") "noreferrer me" "noreferrer" }}
|
||||||
<a class="hx:p-2 hx:text-current" {{ if $external }}target="_blank" rel="{{ $rel }}"{{ end }} href="{{ $link }}" title="{{ or (T .Identifier) .Name | safeHTML }}">
|
<a class="hx:p-2 hx:text-current" {{ if $external }}target="_blank" rel="{{ $rel }}"{{ end }} href="{{ $link }}" title="{{ or (T .Identifier) .Name | safeHTML }}">
|
||||||
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" (printf "height=%d" $iconHeight)) -}}
|
{{- partial "utils/icon.html" (dict "name" .Params.icon "attributes" (printf "height=%d" $iconHeight)) -}}
|
||||||
<span class="hx:sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span>
|
<span class="hx:sr-only">{{ or (T .Identifier) .Name | safeHTML }}</span>
|
||||||
</a>
|
</a>
|
||||||
{{- else if eq .Params.type "theme-toggle" -}}
|
|
||||||
{{- partial "theme-toggle.html" (dict "iconHeight" $iconHeight "hideLabel" (not .Params.label) "iconHeight" $iconHeight "location" "top" "class" "hx:p-2") -}}
|
|
||||||
{{- 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 -}}
|
{{- else -}}
|
||||||
{{- $active := or ($currentPage.HasMenuCurrent "main" .) ($currentPage.IsMenuCurrent "main" .) -}}
|
{{- $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" -}}
|
{{- $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