feat(SW-2283): Added carousel cards block to campaign overview page
Approved-by: Christian Andolf Approved-by: Matilda Landström
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { BlocksEnums } from "@scandic-hotels/trpc/types/blocks"
|
||||
|
||||
import CarouselCards from "@/components/Blocks/CarouselCards"
|
||||
|
||||
import type { BlocksProps } from "@/types/components/blocks"
|
||||
|
||||
export default function Blocks({ blocks }: BlocksProps) {
|
||||
return blocks.map(async (block) => {
|
||||
switch (block.typename) {
|
||||
case BlocksEnums.block.CarouselCards:
|
||||
return (
|
||||
<CarouselCards
|
||||
carousel_cards={block.carousel_cards}
|
||||
key={block.carousel_cards.heading}
|
||||
/>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { getCampaignOverviewPage } from "@/lib/trpc/memoizedRequests"
|
||||
import TopCampaign from "@/components/ContentType/CampaignOverviewPage/TopCampaign"
|
||||
import LinkChips from "@/components/TempDesignSystem/LinkChips"
|
||||
|
||||
import Blocks from "./Blocks"
|
||||
import CampaignOverviewPageSkeleton from "./CampaignOverviewPageSkeleton"
|
||||
|
||||
import styles from "./campaignOverviewPage.module.css"
|
||||
@@ -19,8 +20,7 @@ export default async function CampaignOverviewPage() {
|
||||
notFound()
|
||||
}
|
||||
|
||||
const { campaignOverviewPage } = pageData
|
||||
const { header, topCampaign } = campaignOverviewPage
|
||||
const { header, topCampaign, blocks } = pageData.campaignOverviewPage
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -48,6 +48,7 @@ export default async function CampaignOverviewPage() {
|
||||
|
||||
<main className={styles.mainContent}>
|
||||
<TopCampaign topCampaign={topCampaign} />
|
||||
{blocks.length ? <Blocks blocks={blocks} /> : null}
|
||||
</main>
|
||||
</div>
|
||||
</Suspense>
|
||||
|
||||
@@ -53,7 +53,7 @@ export default async function CampaignPage() {
|
||||
</div>
|
||||
</Typography>
|
||||
</div>
|
||||
{blocks ? <Blocks blocks={blocks} /> : null}
|
||||
{blocks.length ? <Blocks blocks={blocks} /> : null}
|
||||
</div>
|
||||
</Suspense>
|
||||
{/* <TrackingSDK pageData={tracking} /> */}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Block as StartPageBlock } from "@scandic-hotels/trpc/routers/contentstack/startPage/query"
|
||||
import type { Block as AccountPageBlock } from "@scandic-hotels/trpc/types/accountPage"
|
||||
import type { Block as CampaignOverviewPageBlock } from "@scandic-hotels/trpc/types/campaignOverviewPage"
|
||||
import type { Block as CampaignPageBlock } from "@scandic-hotels/trpc/types/campaignPage"
|
||||
import type { Block as CollectionPageBlock } from "@scandic-hotels/trpc/types/collectionPage"
|
||||
import type { Block as ContentPageBlock } from "@scandic-hotels/trpc/types/contentPage"
|
||||
@@ -11,6 +12,7 @@ import type { Block as LoyaltyPageBlock } from "@scandic-hotels/trpc/types/loyal
|
||||
export type Blocks =
|
||||
| AccountPageBlock
|
||||
| CampaignPageBlock
|
||||
| CampaignOverviewPageBlock
|
||||
| CollectionPageBlock
|
||||
| ContentPageBlock
|
||||
| DestinationCityPageBlock
|
||||
|
||||
Reference in New Issue
Block a user