-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
46 lines (40 loc) · 899 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
export type PageId = string
export type PageURL = string
/**
* Page descriptor from the API data
*/
export type PageDescriptor = {
id: PageId
title: string
parentId: PageId
url?: PageURL
pages?: PageId[]
}
/**
* An index of pages by its id
*/
export type PagesIndex = Record<PageId, PageDescriptor | undefined>
export type SectionHighlight = 'parent' | 'child' | undefined
export type PageHighlight = 'active' | SectionHighlight
/**
* The root object we take from the API
*/
export type TableOfContent = {
entities: {
pages: PagesIndex,
},
topLevelIds: PageId[]
}
/**
* The model of an item for the menu, containing all the data to render it
*/
export type MenuItem = {
id: PageId
parentId: PageId
url: PageURL
title: string
level: number
highlight: PageHighlight
hasChildren: boolean
defaultOpenState: boolean
}