Skip to content

Commit 135d3ae

Browse files
authored
Merge pull request #2233 from navikt/mellomsteg-steps-titles
Mellomsteg steps titles
2 parents 9a9cc07 + ac1ae45 commit 135d3ae

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

packages/nextjs/src/components/pages/form-intermediate-step-page/FormIntermediateStepPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const FormIntermediateStepPage = (props: FormIntermediateStepPageProps) =
3737
<div className={style.formIntermediateStepPage}>
3838
<IllustrationStatic illustration={illustration} className={style.pictogram} />
3939
<HeaderWithParent
40-
contentProps={{ data: { title } }}
40+
contentProps={{ data: { title: currentStepData.overrideTitle ?? title } }}
4141
textAboveTitle={textAboveTitle}
4242
className={style.header}
4343
formNumbers={formNumbers}

packages/nextjs/src/components/pages/form-intermediate-step-page/useFormIntermediateStepPage.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,20 @@ const getStepData = (data: FormIntermediateStepPageProps['data'], stepPath: Step
5151
// No steps selected (meaning the user is on first step)
5252
if (stepPath.length === 0) {
5353
return {
54+
overrideTitle: data.title,
5455
editorial: data.editorial,
5556
stepsHeadline: data.stepsHeadline,
5657
steps: data.steps,
5758
};
5859
}
5960

6061
let tmp: any = data;
62+
let lastStepLabel: string | undefined;
6163

6264
stepPath.forEach((index) => {
6365
const foundStep = tmp.steps[index];
6466
if (foundStep) {
67+
lastStepLabel = foundStep.label;
6568
tmp = foundStep.nextStep?.next;
6669
}
6770
});
@@ -72,6 +75,7 @@ const getStepData = (data: FormIntermediateStepPageProps['data'], stepPath: Step
7275
}
7376

7477
return {
78+
overrideTitle: tmp.overrideTitle || lastStepLabel,
7579
editorial: tmp.editorial,
7680
stepsHeadline: tmp.stepsHeadline,
7781
steps: tmp.steps,

packages/nextjs/src/types/content-props/form-intermediate-step.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export type SelectableStep = {
2020
};
2121

2222
export type StepBase = {
23+
overrideTitle?: string;
2324
editorial: ProcessedHtmlProps;
2425
stepsHeadline: string;
2526
steps: SelectableStep[];

0 commit comments

Comments
 (0)