-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFormIntermediateStepPage.tsx
78 lines (73 loc) · 3.4 KB
/
FormIntermediateStepPage.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
69
70
71
72
73
74
75
76
77
78
import React from 'react';
import { Button, Heading } from '@navikt/ds-react';
import { translator } from 'translations';
import { ThemedPageHeader } from 'components/_common/headers/themedPageHeader/ThemedPageHeader';
import { FormIntermediateStepPageProps } from 'types/content-props/form-intermediate-step';
import { ParsedHtml } from 'components/_common/parsed-html/ParsedHtml';
import { LenkeBase } from 'components/_common/lenke/LenkeBase';
import { useFormIntermediateStepPageState } from 'components/pages/form-intermediate-step-page/useFormIntermediateStepPageState';
import { FormIntermediateStepLink } from 'components/pages/form-intermediate-step-page/FormIntermediateStepLink';
import style from './FormIntermediateStepPage.module.scss';
export const FormIntermediateStepPage = (props: FormIntermediateStepPageProps) => {
const { language, type, displayName, modifiedTime, data } = props;
const { title, illustration } = data;
const { currentStepData, backUrl } = useFormIntermediateStepPageState(props);
const getTranslations = translator('form', language);
return (
<div className={style.formIntermediateStepPage}>
<ThemedPageHeader
contentProps={{
type,
displayName,
modifiedTime,
language,
data: {
title,
illustration,
taxonomy: [],
},
}}
showTimeStamp={false}
/>
<div className={style.content}>
<div className={style.stepOptionsWrapper}>
<ParsedHtml htmlProps={currentStepData.editorial} />
{currentStepData.stepsHeadline && (
<Heading level={'2'} size={'medium'} spacing>
{currentStepData.stepsHeadline}
</Heading>
)}
<ul className={style.stepList}>
{currentStepData.steps.map((step) => (
<li key={step.label} className={style.stepItem}>
<FormIntermediateStepLink
{...step}
className={style.stepAction}
analyticsComponent={'mellomsteg'}
analyticsLinkGroup={currentStepData.stepsHeadline}
analyticsLabel={step.label}
/>
</li>
))}
</ul>
</div>
{backUrl && (
<div className={style.buttonGroup}>
<Button
href={backUrl}
shallow={true}
as={LenkeBase}
variant={'tertiary'}
className={style.backButton}
analyticsComponent={'mellomsteg'}
analyticsLinkGroup={currentStepData.stepsHeadline}
analyticsLabel={'Tilbake'}
>
{getTranslations('back')}
</Button>
</div>
)}
</div>
</div>
);
};