Skip to content

Commit

Permalink
Ny brødsmulesti
Browse files Browse the repository at this point in the history
  • Loading branch information
ebelegu committed Nov 28, 2024
1 parent b5fd7ce commit 0a4a2d0
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 88 deletions.
10 changes: 1 addition & 9 deletions src/Pages/Artikkel/Artikkel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,7 @@ export const Artikkel = () => {

return (
<>
<Brodsmulesti
brodsmuler={[
{
url: `/artikkel/${id}`,
title: tittel,
handleInApp: true,
},
]}
/>
<Brodsmulesti/>
<ArtikkelBanner tittel={tittel} />
<div
className={'artikkel-container'}
Expand Down
13 changes: 13 additions & 0 deletions src/Pages/Banner.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,17 @@

.banner__saksoversikt__tittel {
grid-area: tittel;
}

.brodsmulesti {
display: flex;
background: var(--a-bg-default);
padding: 16px 32px;
font-size: 1.125rem;
align-items: center;
}
.brodsmulesti svg {
color: var(--a-text-default);
width: 32px;
height: 32px;
}
65 changes: 17 additions & 48 deletions src/Pages/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { OrganisasjonsDetaljerContext } from './OrganisasjonDetaljerProvider';
import { OrganisasjonerOgTilgangerContext } from './OrganisasjonerOgTilgangerProvider';
import * as Record from '../utils/Record';
import { NotifikasjonWidget } from '@navikt/arbeidsgiver-notifikasjon-widget';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { onBreadcrumbClick, setBreadcrumbs } from '@navikt/nav-dekoratoren-moduler';
import { useSearchParams } from 'react-router-dom';
import { Heading, Loader } from '@navikt/ds-react';
import './Banner.css';
import { LenkeMedLogging } from '../GeneriskeElementer/LenkeMedLogging';
import { HouseIcon } from '@navikt/aksel-icons';

interface OwnProps {
sidetittel?: string;
Expand All @@ -17,19 +18,7 @@ interface OwnProps {
export const SimpleBanner: FunctionComponent<OwnProps> = ({
sidetittel = 'Min side – arbeidsgiver',
}) => {
useEffect(() => {
setBreadcrumbs([
{
url: 'https://arbeidsgiver.nav.no/min-side-arbeidsgiver',
title: 'Min side – arbeidsgiver',
},
]).then(() => {});
}, []);
return (
<Bedriftsmeny
sidetittel={'Min side – arbeidsgiver'}
/>
);
return <Bedriftsmeny sidetittel={'Min side – arbeidsgiver'} />;
};

export const SaksoversiktBanner = () => (
Expand Down Expand Up @@ -77,44 +66,24 @@ export const BannerMedBedriftsmeny: FunctionComponent<OwnProps> = ({ sidetittel
: [];

return (
<Bedriftsmeny
sidetittel={sidetittel}
organisasjoner={orgs}
orgnrSearchParam={useOrgnrHook}
>
<Bedriftsmeny sidetittel={sidetittel} organisasjoner={orgs} orgnrSearchParam={useOrgnrHook}>
<NotifikasjonWidget />
</Bedriftsmeny>
);
};

interface Brodsmule {
url: string;
title: string;
handleInApp: boolean;
}

interface BrodsmuleProps {
brodsmuler: Brodsmule[];
}

export const Brodsmulesti = ({ brodsmuler }: BrodsmuleProps) => {
const navigate = useNavigate();

onBreadcrumbClick((breadcrumb) => {
navigate(breadcrumb.url);
});

const defaultBrodsmule: Brodsmule[] = [
{ url: '/', title: 'Min side – arbeidsgiver', handleInApp: true },
];

const breadcrumbs = defaultBrodsmule.concat(brodsmuler);

useEffect(() => {
setBreadcrumbs(breadcrumbs);
}, [JSON.stringify(brodsmuler)]);

return <></>;
export const Brodsmulesti = () => {
return (
<div className="brodsmulesti">
<LenkeMedLogging
loggLenketekst={`Brødsmulesti - Min side - arbeidsgiver`}
href={"/"}
>
<HouseIcon title="a11y-title" fontSize="1.5rem" />
Min side – arbeidsgiver
</LenkeMedLogging>
</div>
);
};

export const Spinner = () => (
Expand Down
1 change: 0 additions & 1 deletion src/Pages/Hovedside/Hovedside.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const Hovedside: FunctionComponent = () => {

return (
<div>
<Brodsmulesti brodsmuler={[]} />
<div className="hovedside-container">
<AdvarselBannerTestversjon />
<Alerts />
Expand Down
6 changes: 0 additions & 6 deletions src/Pages/OmVirksomheten/OmVirksomheten.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Underenhet from './Underenhet';
import OverordnetEnhet from './OverordnetEnhet';
import './OmVirksomheten.css';
import { Box } from '@navikt/ds-react';
import { Brodsmulesti } from '../Banner';

const Kontaktpanel = ({ children }: { children: React.ReactNode }) => (
<Box className="informasjon-om-bedrift">{children}</Box>
Expand All @@ -21,11 +20,6 @@ const OmVirksomheten: FunctionComponent = () => {

return (
<>
<Brodsmulesti
brodsmuler={[
{ url: '/bedriftsinformasjon', title: 'Om virksomheten', handleInApp: true },
]}
/>
{overordnetenhet !== undefined && underenhet !== undefined ? (
<>
<Kontaktpanel>
Expand Down
36 changes: 12 additions & 24 deletions src/Pages/Pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const Pages: FunctionComponent = () => (
path="/bedriftsinformasjon"
element={
<>
<Brodsmulesti/>
<BannerMedBedriftsmeny
sidetittel={'Om virksomheten'}
/>
Expand All @@ -85,16 +86,8 @@ const Pages: FunctionComponent = () => (
path="/saksoversikt"
element={
<>
<Brodsmulesti/>
<SaksoversiktBanner />
<Brodsmulesti
brodsmuler={[
{
url: '/saksoversikt',
title: 'Saksoversikt',
handleInApp: true,
},
]}
/>
<Saksoversikt />
</>
}
Expand All @@ -104,20 +97,7 @@ const Pages: FunctionComponent = () => (
element={
<>
<SaksoversiktBanner />
<Brodsmulesti
brodsmuler={[
{
url: '/saksoversikt',
title: 'Saksoversikt',
handleInApp: true,
},
{
url: '/sak',
title: 'Sak',
handleInApp: true,
},
]}
/>

<Saksside />
</>
}
Expand All @@ -128,7 +108,15 @@ const Pages: FunctionComponent = () => (
<Navigate to="/saksoversikt" replace={true} />
}
/>
<Route path="/artikkel/:id" element={<Artikkel />} />
<Route
path="/artikkel/:id"
element={
<>
<Brodsmulesti/>
<Artikkel />
</>
}
/>
<Route
path="*"
element={
Expand Down

0 comments on commit 0a4a2d0

Please sign in to comment.