chore: update sidebar item list and link class names

This commit is contained in:
Xin
2024-04-30 22:42:04 +01:00
parent b91cc79674
commit 55af474f51
4 changed files with 19 additions and 20 deletions

View File

@ -1,10 +1,10 @@
{{- $external := strings.HasPrefix .link "http" -}}
{{- $activeClass := cond (.active) "sidebar-item-active" "sidebar-item-inactive" -}}
{{- $activeClass := cond (.active) "active" "inactive" -}}
<a
class="sidebar-item {{ $activeClass }} [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] [word-break:break-word]"
class="hextra-sidebar-item-link {{ $activeClass }} [-webkit-tap-highlight-color:transparent] [-webkit-touch-callout:none] [word-break:break-word]"
href="{{ .link }}"
{{ if $external }}target="_blank" rel="noreferer"{{ end }}
>

View File

@ -4,13 +4,13 @@
<div class="ltr:hx-pr-0 hx-overflow-hidden">
<ul class="sidebar-item-list-container">
<ul class="hextra-sidebar-item-list">
{{- range $items }}
{{- $active := and (not $cached) (or (eq $pageLink .link) (eq (strings.TrimSuffix "/" $pageLink) .link)) -}}
{{- $containsPage := hasPrefix $pageLink .link -}}
{{- $shouldOpen := or (.open) $containsPage $active | default false -}}
<li class="sidebar-item-list hx-flex hx-flex-col {{ if $shouldOpen }}open{{ end }}">
<li class="hextra-sidebar-item hx-flex hx-flex-col {{ if $shouldOpen }}open{{ end }}">
{{- partial "components/sidebar/item-link" (dict "active" $active "title" .title "link" .link "items" .items) -}}
{{- if .items -}}
{{- partial "components/sidebar/render-items" (dict "items" .items "link" .link "cached" $cached) -}}