Skip to content

Commit

Permalink
fix(sidebar): change collapsable by collapsible option (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
enzonotario authored Dec 12, 2024
1 parent abc8f80 commit 8e24335
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/layouts/sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ module.exports = {
startsWith: '',

/**
* Optionally, you can specify if the sidebar items are collapsable. Default is true.
* Optionally, you can specify if the sidebar items are collapsible. Default is true.
*/
collapsable: true,
collapsible: true,

/**
* Optionally, you can specify a depth for the sidebar items. Default is 6, which is the maximum VitePress sidebar depth.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vitepress-openapi",
"type": "module",
"version": "0.0.3-alpha.51",
"version": "0.0.3-alpha.52",
"packageManager": "[email protected]",
"homepage": "https://vitepress-openapi.vercel.app/",
"repository": {
Expand Down
6 changes: 3 additions & 3 deletions src/composables/useSidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,13 @@ export function useSidebar({

function itemsByPaths({
startsWith = '',
collapsable = true,
collapsible = true,
depth = 6,
sidebarItemTemplate = sidebarItemTemplateForMethodPath,
linkPrefix: itemLinkPrefix = linkPrefix,
}: {
startsWith?: string
collapsable?: boolean
collapsible?: boolean
depth?: number
sidebarItemTemplate?: (method: OpenAPIV3.HttpMethods, path: string) => string
linkPrefix?: string
Expand All @@ -219,7 +219,7 @@ export function useSidebar({
const sidebarItems = generateSidebarItemsByPaths({
paths,
startsWith,
collapsable,
collapsible,
depth,
itemLinkPrefix,
sidebarItemTemplate,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/sidebar/generateSidebarItemsByPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { flatSidebarItems } from './flatSidebarItems'
export function generateSidebarItemsByPaths({
paths,
startsWith = '',
collapsable = true,
collapsible = true,
itemLinkPrefix = '',
depth = 6,
sidebarItemTemplate,
}: {
paths: OpenAPIV3.PathsObject
startsWith?: string
collapsable?: boolean
collapsible?: boolean
itemLinkPrefix?: string
depth?: number
sidebarItemTemplate?: (method: OpenAPIV3.HttpMethods, path: string) => string
Expand Down Expand Up @@ -74,7 +74,7 @@ export function generateSidebarItemsByPaths({

sidebarItems = ensureGroupTextSlashPrefix(sidebarItems)

if (collapsable) {
if (collapsible) {
sidebarItems = setItemCollapsedState(sidebarItems)
}

Expand Down
4 changes: 2 additions & 2 deletions test/composables/useSidebar.itemsByPaths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ describe('useSidebar itemsByPaths', () => {

it('generate items by path without collapsed option', () => {
const result = sidebar.itemsByPaths({
collapsable: false,
collapsible: false,
})

expect(
Expand Down Expand Up @@ -342,7 +342,7 @@ describe('useSidebar itemsByPaths', () => {
it('generate items witn linkPrefix option', () => {
const result = sidebar.itemsByPaths({
linkPrefix: '/custom-prefix/',
collapsable: false,
collapsible: false,
})

expect(
Expand Down

0 comments on commit 8e24335

Please sign in to comment.