-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FO Lagt til lenker til til infosider for ytelsane + oppdatert tekst n… (
#4758) FO Lagt til lenker til til infosider for ytelsane + oppdatert tekst når ein ikkje har saker
- Loading branch information
Showing
10 changed files
with
160 additions
and
36 deletions.
There are no files selected for viewing
10 changes: 9 additions & 1 deletion
10
apps/foreldrepengeoversikt/src/components/har-ikke-saker/HarIkkeSaker.stories.tsx
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
32 changes: 32 additions & 0 deletions
32
apps/foreldrepengeoversikt/src/components/har-ikke-saker/HarIkkeSaker.test.tsx
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 { composeStories } from '@storybook/react'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import * as stories from './HarIkkeSaker.stories'; | ||
|
||
const { HarOppdatertSak, Default } = composeStories(stories); | ||
|
||
describe('<HarIkkeSaker>', () => { | ||
it('skal vise infotekst og lenker', async () => { | ||
render(<HarOppdatertSak />); | ||
|
||
expect( | ||
await screen.findByText('Du har ingen søknader om foreldrepenger, engangsstønad eller svangerskapspenger'), | ||
).toBeInTheDocument(); | ||
expect(screen.getByText('Les om hva du har rett på')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om foreldrepenger')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om svangerskapspenger')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om engangsstønad')).toBeInTheDocument(); | ||
}); | ||
|
||
it('skal kun vise lenker', async () => { | ||
render(<Default />); | ||
|
||
expect(await screen.findByText('Les om hva du har rett på')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om foreldrepenger')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om svangerskapspenger')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om engangsstønad')).toBeInTheDocument(); | ||
expect( | ||
screen.queryByText('Du har ingen søknader om foreldrepenger, engangsstønad eller svangerskapspenger'), | ||
).not.toBeInTheDocument(); | ||
}); | ||
}); |
38 changes: 11 additions & 27 deletions
38
apps/foreldrepengeoversikt/src/components/har-ikke-saker/HarIkkeSaker.tsx
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,45 +1,29 @@ | ||
import { ExternalLinkIcon } from '@navikt/aksel-icons'; | ||
import { FunctionComponent } from 'react'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import { Alert, BodyShort, Button, Heading, Link, VStack } from '@navikt/ds-react'; | ||
import { Alert, Heading, VStack } from '@navikt/ds-react'; | ||
|
||
import { useSetBackgroundColor } from '../../hooks/useBackgroundColor'; | ||
import ContentSection from '../content-section/ContentSection'; | ||
import { SøkelenkerPanel } from '../søkelenker/SøkelenkerPanel'; | ||
|
||
interface Props { | ||
harOppdatertSak: boolean; | ||
} | ||
|
||
const HarIkkeSaker: FunctionComponent<Props> = ({ harOppdatertSak }) => { | ||
export const HarIkkeSaker: FunctionComponent<Props> = ({ harOppdatertSak }) => { | ||
useSetBackgroundColor('blue'); | ||
|
||
return ( | ||
<> | ||
<VStack gap="8"> | ||
{harOppdatertSak && ( | ||
<Alert variant="info"> | ||
Vi finner ingen søknader fra deg. Hvis du har sendt en søknad i posten kan det ta to uker før | ||
søknaden registreres i NAVs systemer. | ||
<Heading spacing size="small" level="3"> | ||
<FormattedMessage id="HarIkkeSaker.IngenSoknader" /> | ||
</Heading> | ||
<FormattedMessage id="HarIkkeSaker.ToUker" /> | ||
</Alert> | ||
)} | ||
<ContentSection> | ||
<Heading level="2" size="medium" spacing> | ||
Kort om foreldrepenger | ||
</Heading> | ||
<VStack gap="4"> | ||
<BodyShort> | ||
Foreldrepenger skal erstatte inntekten din når du skal være hjemme med barnet i forbindelse med | ||
fødsel eller adopsjon. | ||
</BodyShort> | ||
<Link href="https://www.nav.no/foreldrepenger"> | ||
Les mer om foreldrepenger <ExternalLinkIcon aria-hidden={true} /> | ||
</Link> | ||
<Button as="a" href="https://foreldrepengesoknad.nav.no" className="w-fit"> | ||
Søk om foreldrepenger | ||
</Button> | ||
</VStack> | ||
</ContentSection> | ||
</> | ||
<SøkelenkerPanel /> | ||
</VStack> | ||
); | ||
}; | ||
|
||
export default HarIkkeSaker; |
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
30 changes: 30 additions & 0 deletions
30
apps/foreldrepengeoversikt/src/components/søkelenker/SøkelenkerPanel.stories.tsx
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,30 @@ | ||
import { Meta, StoryObj } from '@storybook/react/*'; | ||
import { MemoryRouter } from 'react-router-dom'; | ||
|
||
import { LayoutWrapper } from '../../sections/LayoutWrapper'; | ||
import { SøkelenkerPanel } from './SøkelenkerPanel'; | ||
|
||
const meta = { | ||
title: 'SøkelenkerPanel', | ||
component: SøkelenkerPanel, | ||
render: (props) => { | ||
return ( | ||
<MemoryRouter> | ||
<LayoutWrapper className="pt-1 pb-1 pl-4 pr-4"> | ||
<SøkelenkerPanel {...props} /> | ||
</LayoutWrapper> | ||
</MemoryRouter> | ||
); | ||
}, | ||
} satisfies Meta<typeof SøkelenkerPanel>; | ||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export const MedBakgrunn: Story = { | ||
args: { | ||
doBleed: true, | ||
}, | ||
}; |
17 changes: 17 additions & 0 deletions
17
apps/foreldrepengeoversikt/src/components/søkelenker/SøkelenkerPanel.test.tsx
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,17 @@ | ||
import { composeStories } from '@storybook/react'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import * as stories from './SøkelenkerPanel.stories'; | ||
|
||
const { Default } = composeStories(stories); | ||
|
||
describe('<SøkelenkerPanel>', () => { | ||
it('skal vise lenker', async () => { | ||
render(<Default />); | ||
|
||
expect(await screen.findByText('Les om hva du har rett på')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om foreldrepenger')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om svangerskapspenger')).toBeInTheDocument(); | ||
expect(screen.getByText('Søk om engangsstønad')).toBeInTheDocument(); | ||
}); | ||
}); |
46 changes: 46 additions & 0 deletions
46
apps/foreldrepengeoversikt/src/components/søkelenker/SøkelenkerPanel.tsx
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,46 @@ | ||
import { ReactNode } from 'react'; | ||
import { useIntl } from 'react-intl'; | ||
|
||
import { Bleed, HGrid } from '@navikt/ds-react'; | ||
|
||
import { links } from '@navikt/fp-constants'; | ||
|
||
import { LenkePanel } from '../../components/lenke-panel/LenkePanel'; | ||
import { LayoutWrapper } from '../../sections/LayoutWrapper'; | ||
|
||
const PanelBleed = ({ children, doBleed }: { children: ReactNode; doBleed: boolean }) => { | ||
return doBleed ? ( | ||
<div className="pt-12"> | ||
<Bleed marginInline="full" className="bg-surface-neutral-subtle"> | ||
<LayoutWrapper className="pt-1 pb-1 pl-4 pr-4">{children}</LayoutWrapper> | ||
</Bleed> | ||
</div> | ||
) : ( | ||
children | ||
); | ||
}; | ||
|
||
interface Props { | ||
doBleed?: boolean; | ||
} | ||
|
||
export const SøkelenkerPanel = ({ doBleed = false }: Props) => { | ||
const intl = useIntl(); | ||
return ( | ||
<PanelBleed doBleed={doBleed}> | ||
<HGrid gap="4" columns={{ sm: 1, md: 2 }} className={doBleed ? 'mt-12 mb-12' : undefined}> | ||
<LenkePanel | ||
tittel={intl.formatMessage({ id: 'SøkelenkerPanel.HarRett' })} | ||
undertittel={intl.formatMessage({ id: 'SøkelenkerPanel.VenterBarn' })} | ||
to={links.rettOgPlikt} | ||
/> | ||
<LenkePanel tittel={intl.formatMessage({ id: 'SøkelenkerPanel.SokFp' })} to={links.foreldrepenger} /> | ||
<LenkePanel | ||
tittel={intl.formatMessage({ id: 'SøkelenkerPanel.SokSvp' })} | ||
to={links.svangerskapspenger} | ||
/> | ||
<LenkePanel tittel={intl.formatMessage({ id: 'SøkelenkerPanel.SokEs' })} to={links.engangsstonad} /> | ||
</HGrid> | ||
</PanelBleed> | ||
); | ||
}; |
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