Skip to content

Commit

Permalink
fix(nav item): do not open all the items
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelodelain committed Feb 21, 2024
1 parent 68ff6ca commit f5f43bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/runtime/components/StoriesNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const filteredItemList = computed(() => {
<input v-model="search" type="text" :class="$style.search__input" />
<button :class="$style.search__clear" @click="search = ''" />
</div>
<StoriesNavItem v-for="(item, key) in filteredItemList" :key="key" :item="item" :label="key" open />
<StoriesNavItem v-for="(item, key) in filteredItemList" :key="key" :item="item" :label="key" />
</div>
</template>

Expand Down
4 changes: 3 additions & 1 deletion src/runtime/components/StoriesNavItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ function getLinkValues(obj: Object & { to?: string }) {
}, [])
}
const linkValues = computed(() => getLinkValues(props.item))
const hasActiveParentRoute = computed(() => {
return getLinkValues(props.item).includes(route.path)
return linkValues.value.includes(route.path)
})
const isOpen = ref(props.open || hasActiveParentRoute.value)
Expand Down

0 comments on commit f5f43bb

Please sign in to comment.