Skip to content

Commit 5349766

Browse files
Merge pull request #1694 from navikt/logikk-h3-h4-skjemadetalj
Legger til sjekk for visning av h3 / h4 basert på ryddejobb
2 parents 43b19f3 + a5a94c2 commit 5349766

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/components/_common/form-details/FormDetails.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type FormDetailsComponentProps = {
1717
showAddendums?: boolean;
1818
showApplications?: boolean;
1919
showComplaints?: boolean;
20+
showTitleAsLevel4?: boolean;
2021
};
2122
className?: string;
2223
formNumberSelected?: string;
@@ -35,6 +36,7 @@ export const FormDetails = ({
3536
showAddendums = true,
3637
showApplications = true,
3738
showComplaints = true,
39+
showTitleAsLevel4 = false, // Temporary solution until all product pages have been re-organized.
3840
} = displayConfig;
3941

4042
const { formNumbers, formType, languageDisclaimer, ingress, title } =
@@ -70,8 +72,8 @@ export const FormDetails = ({
7072
<div className={classNames(style.formDetails, className)}>
7173
{hasVisibleTitle && (
7274
<Heading
73-
size="medium"
74-
level="3"
75+
size={showTitleAsLevel4 ? 'small' : 'medium'}
76+
level={showTitleAsLevel4 ? '4' : '3'}
7577
spacing={!hasVisibleIngress && !hasVisibleFormNumbers}
7678
>
7779
{title}

src/components/parts/form-details/FormDetailsPart.tsx

+18-2
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,36 @@ import { FormDetailsProps } from 'types/component-props/parts/form-details';
33
import { EditorHelp } from 'components/_editor-only/editor-help/EditorHelp';
44
import { FormDetails } from 'components/_common/form-details/FormDetails';
55
import { FilteredContent } from '../../_common/filtered-content/FilteredContent';
6+
import {
7+
ContentType,
8+
} from 'types/content-props/_content-common';
69

7-
export const FormDetailsPart = ({ config }: FormDetailsProps) => {
10+
export const FormDetailsPart = ({ config, pageProps }: FormDetailsProps) => {
811
const { targetFormDetails, ...displayConfig } = config;
912

13+
// This is a temporary solution to show the title as level 4 on product pages
14+
// that have been re-organized as part of the Maler 2.0.
15+
// When all product pages have been re-organized, we can remove the reference and
16+
// config for showTitleAsLevel4.
17+
const showTitleAsLevel4 =
18+
pageProps.type === ContentType.ProductPage &&
19+
pageProps.data?.showSubsectionNavigation;
20+
1021
if (!targetFormDetails) {
1122
return <EditorHelp text={'Velg hvilken skjemadetalj som skal vises'} />;
1223
}
1324
const formDetails = targetFormDetails.data;
1425

26+
const modifiedDisplayConfig = {
27+
...displayConfig,
28+
showTitleAsLevel4,
29+
};
30+
1531
return (
1632
<FilteredContent {...config}>
1733
<FormDetails
1834
formDetails={formDetails}
19-
displayConfig={displayConfig}
35+
displayConfig={modifiedDisplayConfig}
2036
/>
2137
</FilteredContent>
2238
);

0 commit comments

Comments
 (0)