-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2526 from navikt/modia-new-layout
Initiell layout for nye personsider
- Loading branch information
Showing
18 changed files
with
264 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Box } from '@navikt/ds-react'; | ||
import { usePersonData } from 'src/lib/clients/modiapersonoversikt-api'; | ||
|
||
export const PersonLinje = () => { | ||
const { data } = usePersonData(); | ||
|
||
return ( | ||
<Box borderWidth="1" borderColor="border-subtle" padding="2"> | ||
{data.person.navn[0].fornavn} {data.person.navn[0].etternavn} | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.person-sidebar { | ||
--ac-button-tertiary-text: var(--a-text-default); | ||
|
||
--ac-button-tertiary-hover-bg: var(--a-surface-alt-1-subtle); | ||
--ac-button-tertiary-hover-text: var(--a-text-default); | ||
|
||
--ac-button-tertiary-active-bg: var(--a-surface-alt-1); | ||
--ac-button-tertiary-active-hover-bg: var(--a-surface-alt-1); | ||
--ac-button-tertiary-active-hover-text: var(--a-text-on-alt-1); | ||
--ac-button-tertiary-active-text: var(--a-text-on-alt-1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { | ||
ArrowLeftIcon, | ||
ArrowRightIcon, | ||
BellIcon, | ||
BriefcaseIcon, | ||
ChatIcon, | ||
FaceSmileIcon, | ||
FileIcon, | ||
HandShakeHeartIcon, | ||
PersonGroupIcon, | ||
PiggybankIcon | ||
} from '@navikt/aksel-icons'; | ||
import { Box, Button, VStack } from '@navikt/ds-react'; | ||
import { Link } from '@tanstack/react-router'; | ||
import { type ComponentProps, useState } from 'react'; | ||
import { twMerge } from 'tailwind-merge'; | ||
import './PersonSidebar.css'; | ||
|
||
type MenuItem = { | ||
title: string; | ||
href: ComponentProps<typeof Link>['to']; | ||
Icon: React.ExoticComponent; | ||
}; | ||
|
||
const menuItems = [ | ||
{ | ||
title: 'Oversikt', | ||
href: '/new/person/oversikt', | ||
Icon: FaceSmileIcon | ||
}, | ||
{ | ||
title: 'Oppfølging', | ||
href: '/new/person/oppfolging', | ||
Icon: PersonGroupIcon | ||
}, | ||
{ | ||
title: 'Kommunikasjon', | ||
href: '/new/person/meldinger', | ||
Icon: ChatIcon | ||
}, | ||
{ | ||
title: 'Arbeid', | ||
href: '/new/person/oppfolging', | ||
Icon: BriefcaseIcon | ||
}, | ||
{ | ||
title: 'Utbetaling', | ||
href: '/new/person/utbetaling', | ||
Icon: PiggybankIcon | ||
}, | ||
{ | ||
title: 'Ytelser', | ||
href: '/new/person/ytelser', | ||
Icon: HandShakeHeartIcon | ||
}, | ||
{ | ||
title: 'Dokumenter', | ||
href: '/new/person/saker', | ||
Icon: FileIcon | ||
}, | ||
{ | ||
title: 'Varsler', | ||
href: '/new/person/varsler', | ||
Icon: BellIcon | ||
} | ||
] as const satisfies MenuItem[]; | ||
|
||
export const PersonSidebarMenu = () => { | ||
const [expanded, setExpanded] = useState(true); | ||
|
||
return ( | ||
<Box background="surface-subtle" className="h-dvh" borderRadius="medium" margin="2"> | ||
<Box padding="2" className="flex"> | ||
<Button | ||
aria-hidden | ||
icon={ | ||
expanded ? ( | ||
<ArrowLeftIcon className="group-hover:-translate-x-1" /> | ||
) : ( | ||
<ArrowRightIcon className="group-hover:translate-x-1" /> | ||
) | ||
} | ||
variant="tertiary-neutral" | ||
size="small" | ||
onClick={() => setExpanded((v) => !v)} | ||
className="flex-1 justify-end group" | ||
iconPosition="right" | ||
> | ||
{expanded && <span className="font-normal">Skjul</span>} | ||
</Button> | ||
</Box> | ||
<VStack as="nav" aria-label="Person" padding="2" className="person-sidebar divide-y divide-border-divider"> | ||
{menuItems.map(({ title, href, Icon }) => ( | ||
<Link key={title} to={href}> | ||
{({ isActive }) => ( | ||
<Button | ||
aria-hidden | ||
icon={<Icon aria-hidden />} | ||
variant="tertiary" | ||
size="small" | ||
className={twMerge( | ||
'my-1', | ||
'font-normal', | ||
expanded && ['justify-start', 'min-w-60'], | ||
isActive && [ | ||
'bg-surface-alt-1', | ||
'text-text-on-alt-1', | ||
'hover:bg-surface-alt-1', | ||
'hover:text-text-on-alt-1' | ||
] | ||
)} | ||
> | ||
{expanded && <span className="font-normal">{title}</span>} | ||
</Button> | ||
)} | ||
</Link> | ||
))} | ||
</VStack> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
import { atom } from 'jotai'; | ||
import { atom, useAtomValue } from 'jotai'; | ||
|
||
export const aktivBrukerAtom = atom<string>(); | ||
export const aktivBrukerLastetAtom = atom<boolean>(false); | ||
export const aktivEnhetAtom = atom<string>(); | ||
|
||
const definedAktivBrukerAtom = atom((get) => get(aktivBrukerAtom) ?? 'invalid value'); | ||
|
||
export const usePersonAtomValue = () => { | ||
return useAtomValue(definedAktivBrukerAtom); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { HStack, VStack } from '@navikt/ds-react'; | ||
import { Navigate, Outlet, createLazyFileRoute } from '@tanstack/react-router'; | ||
import { useAtomValue } from 'jotai'; | ||
import { PersonLinje } from 'src/components/PersonLinje'; | ||
import { PersonSidebarMenu } from 'src/components/PersonSidebar'; | ||
import { aktivBrukerAtom } from 'src/lib/state/context'; | ||
|
||
export const Route = createLazyFileRoute('/new/person')({ | ||
component: PersonRoute | ||
}); | ||
|
||
function PersonRoute() { | ||
const aktivBruker = useAtomValue(aktivBrukerAtom); | ||
|
||
if (!aktivBruker) { | ||
return <Navigate to="/" />; | ||
} | ||
|
||
return <PersonLayout />; | ||
} | ||
|
||
function PersonLayout() { | ||
return ( | ||
<VStack className="w-full"> | ||
<PersonLinje /> | ||
<HStack> | ||
<PersonSidebarMenu /> | ||
<Outlet /> | ||
</HStack> | ||
</VStack> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLazyFileRoute } from '@tanstack/react-router'; | ||
|
||
export const Route = createLazyFileRoute('/new/person/meldinger')({ | ||
component: RouteComponent | ||
}); | ||
|
||
function RouteComponent() { | ||
return <div>Hello "/new/person/meldinger"!</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLazyFileRoute } from '@tanstack/react-router'; | ||
|
||
export const Route = createLazyFileRoute('/new/person/oppfolging')({ | ||
component: RouteComponent | ||
}); | ||
|
||
function RouteComponent() { | ||
return <div>Hello "/new/person/oppfolging"!</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLazyFileRoute } from '@tanstack/react-router'; | ||
|
||
export const Route = createLazyFileRoute('/new/person/oversikt')({ | ||
component: RouteComponent | ||
}); | ||
|
||
function RouteComponent() { | ||
return <div>Hello "/new/person/oversikt"!</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLazyFileRoute } from '@tanstack/react-router'; | ||
|
||
export const Route = createLazyFileRoute('/new/person/saker')({ | ||
component: RouteComponent | ||
}); | ||
|
||
function RouteComponent() { | ||
return <div>Hello "/new/person/saker"!</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLazyFileRoute } from '@tanstack/react-router'; | ||
|
||
export const Route = createLazyFileRoute('/new/person/utbetaling')({ | ||
component: RouteComponent | ||
}); | ||
|
||
function RouteComponent() { | ||
return <div>Hello "/new/person/utbetaling"!</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLazyFileRoute } from '@tanstack/react-router'; | ||
|
||
export const Route = createLazyFileRoute('/new/person/varsler')({ | ||
component: RouteComponent | ||
}); | ||
|
||
function RouteComponent() { | ||
return <div>Hello "/new/person/varsler"!</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLazyFileRoute } from '@tanstack/react-router'; | ||
|
||
export const Route = createLazyFileRoute('/new/person/ytelser')({ | ||
component: RouteComponent | ||
}); | ||
|
||
function RouteComponent() { | ||
return <div>Hello "/new/person/ytelser"!</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters