diff --git a/components/ContentType/LoyaltyPage/LoyaltyPage.tsx b/components/ContentType/LoyaltyPage/LoyaltyPage.tsx index afa0e405e..484117c47 100644 --- a/components/ContentType/LoyaltyPage/LoyaltyPage.tsx +++ b/components/ContentType/LoyaltyPage/LoyaltyPage.tsx @@ -3,12 +3,16 @@ import { serverClient } from "@/lib/trpc/server" import { Blocks } from "@/components/Loyalty/Blocks" import Sidebar from "@/components/Loyalty/Sidebar" import MaxWidth from "@/components/MaxWidth" +import Hero from "@/components/TempDesignSystem/Hero" import Title from "@/components/TempDesignSystem/Text/Title" import TrackingSDK from "@/components/TrackingSDK" import styles from "./loyaltyPage.module.css" -export default async function LoyaltyPage() { +import { ImageVaultAsset } from "@/types/components/imageVaultImage" +import type { LangParams } from "@/types/params" + +export default async function LoyaltyPage({ lang }: LangParams) { const loyaltyPageRes = await serverClient().contentstack.loyaltyPage.get() if (!loyaltyPageRes) { @@ -16,7 +20,7 @@ export default async function LoyaltyPage() { } const { tracking, loyaltyPage } = loyaltyPageRes - + const heroImage: ImageVaultAsset = loyaltyPage.header?.hero_image return ( <>
@@ -25,7 +29,15 @@ export default async function LoyaltyPage() { ) : null} - {loyaltyPage.heading} +
+ {loyaltyPage.heading} + {heroImage ? ( + + ) : null} +
{loyaltyPage.blocks ? : null}
diff --git a/components/ContentType/LoyaltyPage/loyaltyPage.module.css b/components/ContentType/LoyaltyPage/loyaltyPage.module.css index a0f140faf..45470127c 100644 --- a/components/ContentType/LoyaltyPage/loyaltyPage.module.css +++ b/components/ContentType/LoyaltyPage/loyaltyPage.module.css @@ -15,6 +15,11 @@ padding-right: var(--Spacing-x2); } +.header { + display: grid; + gap: var(--Spacing-x4); +} + @media screen and (min-width: 1367px) { .content { gap: var(--Spacing-x5); diff --git a/components/TempDesignSystem/Hero/hero.module.css b/components/TempDesignSystem/Hero/hero.module.css new file mode 100644 index 000000000..34ad1b9ea --- /dev/null +++ b/components/TempDesignSystem/Hero/hero.module.css @@ -0,0 +1,8 @@ +.hero { + height: 480px; + margin-bottom: var(--Spacing-x2); + max-width: 100%; + object-fit: cover; + border-radius: var(--Corner-radius-Medium); + margin: 0; +} diff --git a/components/TempDesignSystem/Hero/hero.ts b/components/TempDesignSystem/Hero/hero.ts new file mode 100644 index 000000000..29fd1b8d1 --- /dev/null +++ b/components/TempDesignSystem/Hero/hero.ts @@ -0,0 +1,4 @@ +export interface HeroProps { + alt: string + src: string +} diff --git a/components/TempDesignSystem/Hero/index.tsx b/components/TempDesignSystem/Hero/index.tsx new file mode 100644 index 000000000..fade3e6b0 --- /dev/null +++ b/components/TempDesignSystem/Hero/index.tsx @@ -0,0 +1,17 @@ +import Image from "@/components/Image" + +import { HeroProps } from "./hero" + +import styles from "./hero.module.css" + +export default async function Hero({ alt, src }: HeroProps) { + return ( + {alt} + ) +} diff --git a/lib/graphql/Query/LoyaltyPage.graphql b/lib/graphql/Query/LoyaltyPage.graphql index b0cd9cb29..6ed01ef83 100644 --- a/lib/graphql/Query/LoyaltyPage.graphql +++ b/lib/graphql/Query/LoyaltyPage.graphql @@ -107,6 +107,9 @@ query GetLoyaltyPage($locale: String!, $uid: String!) { } title heading + header { + hero_image + } sidebar { __typename ... on LoyaltyPageSidebarDynamicContent { diff --git a/server/routers/contentstack/loyaltyPage/output.ts b/server/routers/contentstack/loyaltyPage/output.ts index 205509a4c..20a8e3179 100644 --- a/server/routers/contentstack/loyaltyPage/output.ts +++ b/server/routers/contentstack/loyaltyPage/output.ts @@ -191,6 +191,11 @@ const loyaltyPageSidebarItem = z.discriminatedUnion("__typename", [ export const validateLoyaltyPageSchema = z.object({ heading: z.string().nullable(), + header: z + .object({ + hero_image: z.any(), + }) + .nullable(), blocks: z.array(loyaltyPageBlockItem).nullable(), sidebar: z.array(loyaltyPageSidebarItem).nullable(), system: z.object({ diff --git a/server/routers/contentstack/loyaltyPage/query.ts b/server/routers/contentstack/loyaltyPage/query.ts index c23422c4a..0a0b99142 100644 --- a/server/routers/contentstack/loyaltyPage/query.ts +++ b/server/routers/contentstack/loyaltyPage/query.ts @@ -208,8 +208,17 @@ export const loyaltyPageQueryRouter = router({ }) : null + const header = response.data.loyalty_page.header + ? { + hero_image: makeImageVaultImage( + response.data.loyalty_page.header.hero_image + ), + } + : null + const loyaltyPage = { heading: response.data.loyalty_page.heading, + header, system: response.data.loyalty_page.system, blocks, sidebar,