27 lines
1.1 KiB
HTML
27 lines
1.1 KiB
HTML
<div x-cloak x-show="open"
|
|
x-transition:enter="transition ease-out duration-200"
|
|
x-transition:enter-start="opacity-0 transform scale-95"
|
|
x-transition:enter-end="opacity-100 transform scale-100"
|
|
x-transition:leave="transition ease-in duration-75"
|
|
x-transition:leave-start="opacity-100 transform scale-100"
|
|
x-transition:leave-end="opacity-0 transform scale-95"
|
|
class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-20 dark:bg-gray-700">
|
|
{{ range $slug, $data := hugo.Data }}
|
|
{{ if and $data.slug $data.name }}
|
|
{{ $url := partial "category-url.html" (dict "category" $data.slug "units" $data.units) }}
|
|
{{ if not $url }}{{ continue }}{{ end }}
|
|
<a href="{{ $url }}" x-target.push="maincontent"
|
|
class="flex items-center px-2 py-1 text-sm text-gray-800 hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-gray-600">
|
|
{{ $svgPath := printf "img/%s.svg" $data.slug }}
|
|
{{ $svgFile := readFile (printf "static/%s" $svgPath) }}
|
|
{{ if $svgFile }}
|
|
<div class="h-4 w-4 mr-2">{{ $svgFile | safeHTML }}</div>
|
|
{{ else }}
|
|
<span class="h-4 w-4 mr-2"></span>
|
|
{{ end }}
|
|
{{ $data.name }}
|
|
</a>
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|