-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
39 lines (34 loc) · 1.07 KB
/
index.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
import {Home} from "../components/home"
import PageFooter from "../components/footer"
import {PersonalizedHero} from "../components/PersonalizedHero"
import { GetStaticProps } from "next"
import MyClient from "../lib/HearthCoreClient"
import { HeroFields } from "../components/hero"
import { mapIntentJsonToIntentTag } from "../lib/utils";
export default function index(props) {
return (
<>
<PersonalizedHero item={props.heroFieldsList} />
<Home />
<PageFooter />
</>
)
}
export const getStaticProps: GetStaticProps = async (context) => {
const frontPage = await MyClient.delivery.content.byId('d9a1929d-8fbd-4195-9724-226ad23203b8')
const variant = frontPage.heroVariants as any[];
const heroFieldsListToPersonalize = variant.map<HeroFields>(child =>
(
{
headline: child.heroTitle,
heroSubtitle: child.heroSubtitle,
intentTag: mapIntentJsonToIntentTag(child.personalization),
}
)
)
return {
props: {
heroFieldsList: heroFieldsListToPersonalize
}
}
}