Skip to content

Commit c01e899

Browse files
committed
fix: sidebar module collapsible for empty sidebars
1 parent b4cf42e commit c01e899

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/nimiq-vitepress-theme/src/layout/Sidebar.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,10 @@ function openAccordionInitialState(items: NimiqVitepressSidebar['items'][number]
6666
</span>
6767
<CommandMenu v-if="search" f-mt-sm />
6868

69-
<CollapsibleRoot v-model:open="submoduleNavigatorOpen" w-full f-mt-sm>
69+
<!-- Show collapsible when currentDocModule has sidebar content -->
70+
<CollapsibleRoot v-if="currentDocModule?.sidebar?.length" v-model:open="submoduleNavigatorOpen" w-full f-mt-sm>
7071
<CollapsibleTrigger bg-transparent w-full relative group outline="~ 1.5 neutral-300" rounded="6 reka-open:b-0" transition-border-radius of-clip>
71-
<ModulePill v-if="currentDocModule" :item="currentDocModule" component="div" />
72-
<div v-else f-py-sm>
73-
Go to module
74-
</div>
72+
<ModulePill :item="currentDocModule" component="div" />
7573
<div absolute right-16 top-18 i-nimiq:chevron-top-down transition-opacity op="80 group-hocus:100" scale-80 />
7674
</CollapsibleTrigger>
7775

@@ -81,9 +79,14 @@ function openAccordionInitialState(items: NimiqVitepressSidebar['items'][number]
8179
</div>
8280
</CollapsibleContent>
8381
</CollapsibleRoot>
82+
83+
<!-- Show expanded module pills when currentDocModule has no sidebar -->
84+
<div v-else-if="currentDocModule && (!currentDocModule.sidebar || !currentDocModule.sidebar.length)" w-full f-mt-sm>
85+
<ModulePill v-for="item in visibleModules" :key="item.text" :item="item" component="a" />
86+
</div>
8487
</div>
8588

86-
<template v-if="currentDocModule">
89+
<template v-if="currentDocModule?.sidebar?.length">
8790
<hr w-full border="t-1 neutral-400" f-mt-xs>
8891

8992
<DefineSidebarItem v-slot="{ item: { text, link, icon }, isInAccordion }">

0 commit comments

Comments
 (0)