* changed to new sidebar across projects except resources * finalize multi sidebar support * clean up * remove redundant property * small changes * fixes * generate * fix error * fix initial open
23 lines
464 B
TypeScript
23 lines
464 B
TypeScript
import { Sidebar } from "types"
|
|
|
|
const commonOptions: Partial<Sidebar.RawSidebarItem> = {
|
|
loaded: true,
|
|
isPathHref: true,
|
|
}
|
|
|
|
export function sidebarAttachCommonOptions(
|
|
sidebar: Sidebar.RawSidebarItem[]
|
|
): Sidebar.RawSidebarItem[] {
|
|
return sidebar.map((item) => {
|
|
if (item.type === "separator") {
|
|
return item
|
|
}
|
|
|
|
return {
|
|
...commonOptions,
|
|
...item,
|
|
children: sidebarAttachCommonOptions(item.children || []),
|
|
}
|
|
})
|
|
}
|