-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyAppsSideMenu.tsx
68 lines (64 loc) · 2.08 KB
/
MyAppsSideMenu.tsx
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { ReactElement } from 'react'
import Link from 'next/link'
import { SideMenu, Pages, ChildPages, RootPages } from '@navikt/dinesykmeldte-sidemeny'
interface Props {
value: string
}
function MyAppsSideMenu({ value }: Props): ReactElement {
return (
<SideMenu
sykmeldtName="Jon Kåre"
sykmeldtId="123456789"
activePage={routeToEnum(value)}
routes={{
Soknader: 0,
Sykmeldinger: 1,
Meldinger: 2,
Dialogmoter: {
notifications: 3,
internalRoute: ({ children, ...rest }) => (
<Link href="/some/route" passHref legacyBehavior>
<a {...rest}>{children}</a>
</Link>
),
},
Oppfolgingsplaner: {
notifications: 0,
internalRoute: ({ children, ...rest }) => (
<Link href="/some-other/route" passHref legacyBehavior>
<a {...rest}>{children}</a>
</Link>
),
},
DineSykmeldte: 0,
}}
/>
)
}
function routeToEnum(value: string): Pages {
switch (value) {
case 'sykmeldinger':
return RootPages.Sykmeldinger
case 'soknader':
return RootPages.Soknader
case 'meldinger':
return RootPages.Meldinger
case 'dialogmoter':
return RootPages.Dialogmoter
case 'oppfolgingsplaner':
return RootPages.Oppfolgingsplaner
case 'sykmelding':
return ChildPages.Sykmelding
case 'soknad':
return ChildPages.Soknad
case 'melding':
return ChildPages.Melding
case 'dialogmote':
return ChildPages.Dialogmote
case 'oppfolgingsplan':
return ChildPages.Oppfolgingsplan
default:
throw new Error(`Unknown route: ${value}`)
}
}
export default MyAppsSideMenu