feat: Add icon on sidebar menu

This commit is contained in:
Simon 2024-03-12 10:46:33 +01:00
parent c69fd0059f
commit 667b675aa3
2 changed files with 20 additions and 1 deletions

View File

@ -1 +1,17 @@
// Put your custom SCSS code here // Put your custom SCSS code here
.docs-links {
overflow-y: inherit!important;
svg {
height: 24px!important;
width: 24px!important;
margin-bottom: 0!important;
}
.with-icon {
position: relative;
svg {
position: absolute;
left: calc(-24px - 1rem);
}
}
}

View File

@ -88,7 +88,10 @@ skipped. To override this behavior, set $skipHome to false below.
<li {{- with $liClass }} class="{{ . }}" {{ end -}}> <li {{- with $liClass }} class="{{ . }}" {{ end -}}>
{{- with $node.Page.Pages }} {{- with $node.Page.Pages }}
<details{{- with $ariaCurrent }} open{{- end }}{{- if ne $node.Page.Params.sidebar.collapsed true }} open{{- end }}> <details{{- with $ariaCurrent }} open{{- end }}{{- if ne $node.Page.Params.sidebar.collapsed true }} open{{- end }}>
<summary>{{ $linkContent }}</summary> <summary>
{{ if $node.Page.Params.icon }}{{- partial "inline-svg" $node.Page.Params.icon -}}{{ end }}
{{ $linkContent }}
</summary>
<ul class="list-unstyled list-nested"> <ul class="list-unstyled list-nested">
{{- range . }} {{- range . }}
{{- template "walk" (dict "node" . "currentPage" $currentPage) }} {{- template "walk" (dict "node" . "currentPage" $currentPage) }}