1
0
mirror of https://github.com/docker/docs.git synced 2026-10-25 06:09:46 +03:00
Files
docs/layouts/_partials/sidebar/mainnav.html
David Karlsson ee71c80562 chore: migrate icons from Material Symbols to Heroicons
Replaces @material-symbols/svg-400 (5.5 MB) with heroicons (488 KB) — an
11x reduction in icon asset size. Heroicons uses a single consistent
distribution format (24px solid SVGs, fill="currentColor") eliminating
the need for the separate utils/svg.html partial, the icon-svg-stroke CSS
utility, and the dual-path resolution logic in icon.html.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2026-05-18 12:05:54 +02:00

62 lines
2.0 KiB
HTML

{{- /*
Complements the section-specific sidebar navigation.
- Renders the main navigation for site sections, linking to the current or ancestor section/page.
- Uses the `site.Menus.main` configuration to determine primary navigation structure.
- Toggles visibility of nested menu items for the main sections.
*/
-}}
<!-- Main navigation for the sidebar -->
<div class="px-2 py-4 md:hidden text-gray-700 dark:text-gray-200 card " x-data="{ expanded: false }">
<div class="flex w-full items-center justify-between">
<!-- Current section: use menu, fall back to current section or page -->
{{- $curr := .FirstSection }}
{{- if eq $curr site.Home }}
{{- $curr = . }}
{{- end }}
{{- range site.Menus.main }}
{{- if or (.Page.IsAncestor page) (eq .Page page) }}
{{- $curr = .Page }}
{{- end }}
{{- end }}
<a
class="hover:text-blue dark:hover:text-blue"
href="{{ $curr.Permalink }}"
>
{{- with $curr.Params.icon }}
<span class="icon-sm icon-svg pr-2">
{{- partialCached "icon" . . -}}
</span>
{{- end }}
{{- $curr.LinkTitle -}}
</a>
<button
@click="expanded = !expanded"
class="rounded-sm px-1 hover:bg-gray-200 hover:dark:bg-gray-800"
>
<span x-show="! expanded" class="icon-svg icon-sm">
{{ partialCached "icon" "chevron-down" "chevron-down" }}
</span>
<span x-cloak x-show="expanded" class="icon-svg icon-sm">
{{ partialCached "icon" "chevron-up" "chevron-up" }}
</span>
</button>
</div>
<ul x-cloak x-show="expanded" class="space-y-4 pt-4">
{{ range site.Menus.main }}
{{ if ne page.FirstSection .Page }}
<li>
<a class="hover:text-blue dark:hover:text-blue" href="{{ .URL }}">
{{- with .Page.Params.icon }}
<span class="icon-sm icon-svg pr-2">
{{- partialCached "icon" . . -}}
</span>
{{- end }}
{{- .Name }}
</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>