1export type NavigationType = 'section' | 'group' | 'page'; 2 3export type NavigationNode = Section | Group | Page; 4 5export type NavigationRenderProps = { 6 /** The navigation node or route to render */ 7 route: NavigationNode; 8 /** If this navigation node is considered "active", e.g. current page or containing current page */ 9 isActive?: boolean; 10}; 11 12export type Node<Type extends NavigationType, Data extends object> = Data & { 13 /** The type of the navigation node */ 14 type: Type; 15 /** The name of the navigation node */ 16 name: string; 17 /** If this navigation node should be rendered */ 18 hidden?: boolean; 19}; 20 21export type Section = Node< 22 'section', 23 { 24 /** The groups or pages it should render within the collapsible section */ 25 children: (Group | Page)[]; 26 /** If the section should be rendered as "closed" by default. Defaults to false. */ 27 expanded?: boolean; 28 } 29>; 30 31export type Group = Node< 32 'group', 33 { 34 /** The pages it should render within the group list */ 35 children: Page[]; 36 } 37>; 38 39export type Page = Node< 40 'page', 41 { 42 /** The display text of the link in the sidebar, falls back to `name` */ 43 sidebarTitle?: string; 44 /** The pathname to link to the page */ 45 href: string; 46 } 47>; 48