@@ -20,17 +20,20 @@ import { StandaloneCardSection } from "./sections/StandaloneCardSection"
2020import { VideoSection } from "./sections/VideoSection"
2121import { WideHeroSection } from "./sections/WideHeroSection"
2222import { StatsSection } from "./sections/StatsSection"
23+ import { ActionsPageClient } from "./ActionsPageClient"
24+ import type { ActionItem } from "@/lib/cms"
2325
2426type PageBlock = NonNullable < Page [ "layout" ] > [ number ]
2527
2628interface PageBlocksRendererProps {
2729 blocks ?: PageBlock [ ] | null
30+ actions ?: ActionItem [ ]
2831 cardRowChildren ?: ReactNode
2932 ctaFloating ?: boolean
3033 locale ?: AppLocale
3134}
3235
33- type PageBlockRenderOptions = Pick < PageBlocksRendererProps , "cardRowChildren" | "ctaFloating" | "locale" >
36+ type PageBlockRenderOptions = Pick < PageBlocksRendererProps , "actions" | " cardRowChildren" | "ctaFloating" | "locale" >
3437type BlockRenderer = ( block : PageBlock , options : PageBlockRenderOptions ) => ReactNode
3538
3639const pageBlockRenderers : Partial < Record < PageBlock [ "blockType" ] , BlockRenderer > > = {
@@ -53,17 +56,18 @@ const pageBlockRenderers: Partial<Record<PageBlock["blockType"], BlockRenderer>>
5356 widehero : ( block ) => < WideHeroSection content = { block as Extract < PageBlock , { blockType : "widehero" } > } /> ,
5457 listFeature : ( block ) => < ListFeatureSection content = { block as Extract < PageBlock , { blockType : "listFeature" } > } /> ,
5558 stats : ( block ) => < StatsSection content = { block as Extract < PageBlock , { blockType : "stats" } > } /> ,
59+ actions : ( block , options ) => < ActionsPageClient actions = { options . actions ?? [ ] } locale = { options . locale ?? "en" } content = { block as Extract < PageBlock , { blockType : "actions" } > } /> ,
5660}
5761
5862function renderPageBlock ( block : PageBlock , options : PageBlockRenderOptions ) {
5963 const renderer = pageBlockRenderers [ block . blockType ]
6064 return renderer ? renderer ( block , options ) : null
6165}
6266
63- export function PageBlocks ( { blocks, cardRowChildren, ctaFloating = false , locale } : PageBlocksRendererProps ) {
67+ export function PageBlocks ( { blocks, actions , cardRowChildren, ctaFloating = false , locale } : PageBlocksRendererProps ) {
6468 const renderableBlocks =
6569 blocks ?. flatMap ( ( block ) => {
66- const element = renderPageBlock ( block , { cardRowChildren, ctaFloating, locale } )
70+ const element = renderPageBlock ( block , { actions , cardRowChildren, ctaFloating, locale } )
6771 return element ? [ { block, element } ] : [ ]
6872 } ) ?? [ ]
6973
0 commit comments