Skip to content

Commit

Permalink
keep accordion in sidebar open if active
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Apr 9, 2024
1 parent f7e9224 commit 4ba2e91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .vitepress/theme/components/SidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
// collapsible,
// isLink,
isActiveLink,
// hasActiveLink,
hasActiveLink,
hasChildren,
// toggle,
} = useSidebarControl(computed(() => props.item))
Expand Down Expand Up @@ -90,7 +90,7 @@ function treatAsHtml(filename: string): boolean {
{{ item.text }}
</a>

<Accordion.Root v-else type="single" :default-value="collapsed ? item.text : ''" collapsible>
<Accordion.Root v-else type="single" :default-value="(collapsed || hasActiveLink) ? item.text : ''" collapsible>
<Accordion.Item :value="item.text">
<Accordion.Header as="div">
<Accordion.Trigger class="group" flex="~ items-center gap-8">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"jszip": "^3.10.1",
"markdown-it-mathjax3": "^4.3.2",
"medium-zoom": "^1.1.0",
"nimiq-css": "^0.0.63",
"nimiq-css": "^0.0.65",
"prettier": "^3.2.5",
"radix-vue": "^1.6.2",
"svg-packer": "^0.0.3",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4ba2e91

Please sign in to comment.