Improve language picker usability

This commit is contained in:
BBaoVanC 2021-11-19 17:22:25 -06:00
parent 15d9ad52e9
commit 7a73432238
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
2 changed files with 26 additions and 1 deletions

View File

@ -236,6 +236,15 @@ footer {
list-style: none;
}
.langpicker .unavailable {
color: inherit;
}
.langpicker .unavailable:hover {
cursor: not-allowed;
text-decoration: none;
}
/* Basic elements */

View File

@ -26,11 +26,27 @@
{{ partial "icon.html" "world" -}}
</summary>
<ul class="languages">
{{ range .Site.Home.AllTranslations }}
{{ range .AllTranslations }}
<li>
<a class="langpicker-item{{ if eq .Language $.Site.Language }} active{{ end }}" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
</li>
{{ end }}
{{ $site_translations := slice }}
{{ range .Site.Languages }}
{{ $site_translations = $site_translations | append .LanguageName }}
{{ end }}
{{ $translation_codes := slice }}
{{ range .AllTranslations }}
{{ $translation_codes = $translation_codes | append .Language }}
{{ end }}
{{ range (.Site.Languages | complement $translation_codes) }}
<li>
<a class="langpicker-item unavailable">{{ .LanguageName }}</a>
</li>
{{ end }}
</ul>
</details>
{{ end }}