-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLandingPage.tsx
More file actions
87 lines (83 loc) · 2.64 KB
/
Copy pathLandingPage.tsx
File metadata and controls
87 lines (83 loc) · 2.64 KB
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
79
80
81
82
83
84
85
86
87
import type {
PageContentLayoutProps,
PageType,
} from '@city-of-helsinki/react-helsinki-headless-cms';
import {
PageSection,
ContentContainer,
} from '@city-of-helsinki/react-helsinki-headless-cms';
import React from 'react';
import LandingPageSearch from '../landingPageSearch/LandingPageSearch';
import styles from './landingPage.module.scss';
export type LandingPageProps = {
page?: PageType;
};
export function LandingPageContentLayout({
page,
collections,
}: LandingPageProps & PageContentLayoutProps) {
const {
mediaItemUrl: heroImage,
altText: heroImageAlt,
photographerName,
} = page?.featuredImage?.node ?? {};
const [firstCollection, ...restCollections] =
(collections as React.ReactNode[]) ?? [];
const lastCollection = restCollections.pop();
return (
<div className={styles.layout}>
<div className={styles.main}>
<div className={styles.highlight}>
<PageSection
className={styles.sectionHero}
korosBottom
korosBottomClassName={styles.korosBottomHero}
>
<figure className={styles.heroFigure}>
<img src={heroImage ?? ''} alt={heroImageAlt ?? ''} />
{photographerName && (
<div className={styles.heroModuleLabel}>{photographerName}</div>
)}
</figure>
</PageSection>
<PageSection className={styles.sectionSearch}>
<ContentContainer>
<div className={styles.sectionSearchContent}>
<LandingPageSearch />
</div>
</ContentContainer>
</PageSection>
</div>
{firstCollection && (
<PageSection
korosTop
korosTopClassName={styles.korosTopCollectionsFirst}
className={styles.sectionCollectionsFirst}
>
<ContentContainer>{firstCollection}</ContentContainer>
</PageSection>
)}
{restCollections && (
<PageSection
korosTop
korosTopClassName={styles.korosTopCollectionsRest}
className={styles.sectionCollections}
>
<ContentContainer>{restCollections}</ContentContainer>
</PageSection>
)}
{lastCollection && (
<PageSection
korosTop
korosBottom
korosTopClassName={styles.korosTopCollectionsLast}
korosBottomClassName={styles.korosBottomCollectionsLast}
className={styles.sectionCollectionsLast}
>
<ContentContainer>{lastCollection}</ContentContainer>
</PageSection>
)}
</div>
</div>
);
}