-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGeneralPageHeader.tsx
45 lines (40 loc) · 1.66 KB
/
GeneralPageHeader.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
import { BodyLong, Heading } from '@navikt/ds-react';
import {
PagePropsForPageHeader,
getContentTagline,
} from 'components/_common/headers/sharedHeaderUtils';
import { Illustration } from 'components/_common/illustration/Illustration';
import { ContentProps, ContentType } from 'types/content-props/_content-common';
import { classNames } from 'utils/classnames';
import { GeneralPageHeaderTagLine } from './GeneralPageHeaderTagLine';
import style from './GeneralPageHeader.module.scss';
type Props = {
pageProps: ContentProps;
hideIngressOverride?: boolean;
};
export const GeneralPageHeader = (props: Props) => {
const { pageProps } = props as { pageProps: PagePropsForPageHeader };
const illustration = pageProps.data.illustration;
const tagLine = getContentTagline(pageProps);
const title = pageProps.data.title || pageProps.displayName;
const { ingress, hideIngress } = pageProps.data;
const isSituationPage = pageProps.type === ContentType.SituationPage;
return (
<div className={style.generalPageHeader}>
<Illustration illustration={illustration} className={style.illustration} />
{tagLine && <GeneralPageHeaderTagLine tagLine={tagLine} />}
<Heading
level="1"
size="xlarge"
className={classNames(style.header, isSituationPage && style.reduceMarginBottom)}
>
{title}
</Heading>
{ingress && !hideIngress && !props.hideIngressOverride && (
<BodyLong className={style.ingress} size="large">
{ingress}
</BodyLong>
)}
</div>
);
};