Skip to content

Commit 4bbe890

Browse files
authored
NAV-26302: styled components 20251220 (#4218)
* NAV-26302: Erstatter RegistrerInstitusjo styled-components med Aksel primitive * Skriv om filtreringsregler fra styled-components til Aksel primitive * Oppdater registeropplysninger og vilkårsvurdering fra styled-components til aksel og module.css
1 parent 9fe28eb commit 4bbe890

File tree

10 files changed

+80
-126
lines changed

10 files changed

+80
-126
lines changed

src/frontend/sider/Fagsak/Behandling/Sider/FiltreringFødselshendelser/Filtreringsregler.tsx

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React from 'react';
22

33
import { useNavigate } from 'react-router';
4-
import styled from 'styled-components';
54

6-
import { BodyShort } from '@navikt/ds-react';
5+
import { BodyShort, List } from '@navikt/ds-react';
76

87
import useSakOgBehandlingParams from '../../../../../hooks/useSakOgBehandlingParams';
98
import VilkårResultatIkon from '../../../../../ikoner/VilkårResultatIkon';
@@ -16,20 +15,6 @@ interface IProps {
1615
åpenBehandling: IBehandling;
1716
}
1817

19-
const StyledUl = styled.ul`
20-
list-style: none;
21-
padding-left: 0;
22-
`;
23-
24-
const StyledLi = styled.li`
25-
display: flex;
26-
padding-bottom: 1rem;
27-
`;
28-
29-
const StyledBodyShort = styled(BodyShort)`
30-
margin-left: 0.5rem;
31-
`;
32-
3318
const Filtreringsregler: React.FC<IProps> = ({ åpenBehandling }) => {
3419
const { fagsakId } = useSakOgBehandlingParams();
3520
const navigate = useNavigate();
@@ -45,7 +30,7 @@ const Filtreringsregler: React.FC<IProps> = ({ åpenBehandling }) => {
4530
senderInn={false}
4631
steg={BehandlingSteg.FILTRERING_FØDSELSHENDELSER}
4732
>
48-
<StyledUl>
33+
<List>
4934
{Object.keys(Filtreringsregel).map(filtreringsregel => {
5035
const fødselshendelsefiltreringResultat = åpenBehandling.fødselshendelsefiltreringResultater.find(
5136
it => it.filtreringsregel === filtreringsregel
@@ -54,15 +39,18 @@ const Filtreringsregler: React.FC<IProps> = ({ åpenBehandling }) => {
5439
if (!fødselshendelsefiltreringResultat) return null;
5540

5641
return (
57-
<StyledLi key={filtreringsregel}>
58-
<VilkårResultatIkon resultat={fødselshendelsefiltreringResultat.resultat} />
59-
<StyledBodyShort>
42+
<List.Item
43+
aria-hidden
44+
icon={<VilkårResultatIkon resultat={fødselshendelsefiltreringResultat.resultat} />}
45+
key={filtreringsregel}
46+
>
47+
<BodyShort>
6048
{filtreringsregler[fødselshendelsefiltreringResultat.filtreringsregel]}
61-
</StyledBodyShort>
62-
</StyledLi>
49+
</BodyShort>
50+
</List.Item>
6351
);
6452
})}
65-
</StyledUl>
53+
</List>
6654
</Skjemasteg>
6755
);
6856
};

src/frontend/sider/Fagsak/Behandling/Sider/RegistrerInstitusjon/RegistrerInstitusjon.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as React from 'react';
22

3-
import styled from 'styled-components';
4-
53
import { Alert } from '@navikt/ds-react';
64
import { RessursStatus } from '@navikt/familie-typer';
75

@@ -12,10 +10,6 @@ import { BehandlingSteg, type IBehandling } from '../../../../../typer/behandlin
1210
import { useBehandlingContext } from '../../context/BehandlingContext';
1311
import Skjemasteg from '../Skjemasteg';
1412

15-
const StyledSkjemasteg = styled(Skjemasteg)`
16-
max-width: 40rem;
17-
`;
18-
1913
interface IProps {
2014
åpenBehandling: IBehandling;
2115
}
@@ -31,7 +25,7 @@ const RegistrerInstitusjon: React.FC<IProps> = ({ åpenBehandling }) => {
3125
}
3226

3327
return (
34-
<StyledSkjemasteg
28+
<Skjemasteg
3529
className={'mottaker'}
3630
tittel={'Info om institusjon'}
3731
nesteOnClick={onSubmitMottaker}
@@ -47,7 +41,7 @@ const RegistrerInstitusjon: React.FC<IProps> = ({ åpenBehandling }) => {
4741
<Alert children={samhandlerRessurs.frontendFeilmelding} variant={'error'} />
4842
)}
4943
{submitFeilmelding && <Alert variant="error" children={submitFeilmelding} />}
50-
</StyledSkjemasteg>
44+
</Skjemasteg>
5145
);
5246
};
5347

src/frontend/sider/Fagsak/Behandling/Sider/Skjemasteg.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const Skjemasteg: React.FunctionComponent<IProps> = ({
8383
}
8484

8585
return (
86-
<Box marginBlock={'space-0 space-128'}>
86+
<Box marginBlock={'space-0 space-128'} maxWidth={'40rem'}>
8787
<VStack id={'skjemasteg'} paddingInline={'space-32'} paddingBlock={'space-24'} gap={'space-16'}>
8888
<BehandlingPåVentAlert />
8989
<MidlertidigEnhetAlert />

src/frontend/sider/Fagsak/Behandling/Sider/Vilkårsvurdering/Registeropplysninger/HentetLabel.tsx

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.regularHeading {
2+
font-weight: var(--a-font-weight-regular);
3+
}
4+
5+
.detail {
6+
color: var(--a-text-subtle);
7+
margin-bottom: var(--a-spacing-4);
8+
}

src/frontend/sider/Fagsak/Behandling/Sider/Vilkårsvurdering/Registeropplysninger/Registeropplysninger.tsx

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import React from 'react';
22

3-
import styled from 'styled-components';
4-
53
import {
64
CalendarIcon,
75
FlowerPetalFallingIcon,
@@ -10,23 +8,14 @@ import {
108
HouseIcon,
119
PassportIcon,
1210
} from '@navikt/aksel-icons';
13-
import { Heading } from '@navikt/ds-react';
14-
import { AFontWeightRegular, ASpacing4 } from '@navikt/ds-tokens/dist/tokens';
11+
import { Box, Detail, Heading } from '@navikt/ds-react';
1512

16-
import { HentetLabel } from './HentetLabel';
13+
import styles from './Registeropplysninger.module.css';
1714
import RegisteropplysningerTabell from './RegisteropplysningerTabell';
1815
import type { IRestRegisterhistorikk } from '../../../../../../typer/person';
1916
import { Registeropplysning } from '../../../../../../typer/registeropplysning';
2017
import { Datoformat, isoStringTilFormatertString } from '../../../../../../utils/dato';
2118

22-
const Container = styled.div`
23-
width: 32rem;
24-
`;
25-
26-
const SemiBoldHeading = styled(Heading)`
27-
font-weight: ${AFontWeightRegular};
28-
`;
29-
3019
interface IRegisteropplysningerProps {
3120
registerHistorikk: IRestRegisterhistorikk;
3221
fødselsdato: string;
@@ -37,13 +26,12 @@ const Registeropplysninger: React.FC<IRegisteropplysningerProps> = ({ registerHi
3726

3827
return (
3928
<>
40-
<SemiBoldHeading level={'3'} size="medium">
29+
<Heading className={styles.regularHeading} level={'3'} size="medium">
4130
Registeropplysninger
42-
</SemiBoldHeading>
43-
<Container>
44-
<HentetLabel
45-
size={'small'}
46-
style={{ marginBottom: ASpacing4 }}
31+
</Heading>
32+
<Box width={'32rem'}>
33+
<Detail
34+
className={styles.detail}
4735
children={
4836
'Sist hentet fra Folkeregisteret ' +
4937
isoStringTilFormatertString({
@@ -105,7 +93,7 @@ const Registeropplysninger: React.FC<IRegisteropplysningerProps> = ({ registerHi
10593
historikk={registerHistorikk.deltBosted}
10694
/>
10795
)}
108-
</Container>
96+
</Box>
10997
</>
11098
);
11199
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.table {
2+
margin-left: var(--a-spacing-4);
3+
}
4+
5+
.opplysningsIkon {
6+
padding-top: var(--a-spacing-2);
7+
}
8+
9+
.headerCell {
10+
&:nth-of-type(1) {
11+
width: 15rem;
12+
}
13+
14+
&:nth-of-type(2) {
15+
width: 12rem;
16+
}
17+
}

src/frontend/sider/Fagsak/Behandling/Sider/Vilkårsvurdering/Registeropplysninger/RegisteropplysningerTabell.tsx

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import type { ReactNode } from 'react';
22
import React, { useState } from 'react';
33

44
import { differenceInMilliseconds } from 'date-fns';
5-
import styled from 'styled-components';
65

76
import { ChevronDownIcon, ChevronUpIcon } from '@navikt/aksel-icons';
8-
import { Button, Table } from '@navikt/ds-react';
7+
import { Button, HStack, Table } from '@navikt/ds-react';
98

9+
import styles from './RegisteropplysningerTabell.module.css';
1010
import type { IRestRegisteropplysning } from '../../../../../../typer/person';
1111
import { Registeropplysning, registeropplysning } from '../../../../../../typer/registeropplysning';
1212
import {
@@ -17,35 +17,6 @@ import {
1717
tidenesMorgen,
1818
} from '../../../../../../utils/dato';
1919

20-
const Container = styled.div`
21-
display: flex;
22-
margin-top: 1rem;
23-
justify-content: space-between;
24-
width: 100%;
25-
`;
26-
27-
const StyledHeaderCell = styled(Table.HeaderCell)`
28-
&:nth-of-type(1) {
29-
width: 15rem;
30-
}
31-
&:nth-of-type(2) {
32-
width: 12rem;
33-
}
34-
`;
35-
36-
const StyledTable = styled(Table)`
37-
margin-left: 1rem;
38-
`;
39-
40-
const OpplysningsIkon = styled.div`
41-
padding-top: 0.5rem;
42-
`;
43-
44-
const HøyrejustertKnapperad = styled.div`
45-
display: flex;
46-
flex-direction: row-reverse;
47-
`;
48-
4920
interface IRegisteropplysningerTabellProps {
5021
opplysningstype: Registeropplysning;
5122
ikon: ReactNode;
@@ -110,16 +81,23 @@ const RegisteropplysningerTabell: React.FC<IRegisteropplysningerTabellProps> = (
11081

11182
return (
11283
<>
113-
<Container>
114-
<OpplysningsIkon children={ikon} />
115-
<StyledTable
84+
<HStack wrap={false} marginBlock={'space-16 space-0'} justify={'space-between'} width={'100%'}>
85+
<div className={styles.opplysningsIkon} children={ikon} />
86+
<Table
87+
className={styles.table}
11688
size={'small'}
11789
aria-label={`Registeropplysninger for ${registeropplysning[opplysningstype]}`}
11890
>
11991
<Table.Header>
12092
<Table.Row>
121-
<StyledHeaderCell children={registeropplysning[opplysningstype]} />
122-
<StyledHeaderCell children={hentDatoHeader(opplysningstype)} />
93+
<Table.HeaderCell
94+
className={styles.headerCell}
95+
children={registeropplysning[opplysningstype]}
96+
/>
97+
<Table.HeaderCell
98+
className={styles.headerCell}
99+
children={hentDatoHeader(opplysningstype)}
100+
/>
123101
</Table.Row>
124102
</Table.Header>
125103
<Table.Body>
@@ -137,10 +115,10 @@ const RegisteropplysningerTabell: React.FC<IRegisteropplysningerTabellProps> = (
137115
</Table.Row>
138116
))}
139117
</Table.Body>
140-
</StyledTable>
141-
</Container>
118+
</Table>
119+
</HStack>
142120
{skalVæreEkspanderbar && (
143-
<HøyrejustertKnapperad>
121+
<HStack justify={'end'}>
144122
<Button
145123
variant="tertiary"
146124
size="small"
@@ -150,7 +128,7 @@ const RegisteropplysningerTabell: React.FC<IRegisteropplysningerTabellProps> = (
150128
>
151129
{erEkspandert ? 'Skjul' : `Vis ${historikk.length - GRENSE_FOR_EKSPANDERBAR_HISTORIKK} flere`}
152130
</Button>
153-
</HøyrejustertKnapperad>
131+
</HStack>
154132
)}
155133
</>
156134
);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.hentetLabel {
2+
color: var(--a-text-subtle);
3+
}

0 commit comments

Comments
 (0)