Builds the markers, data block and stand-in host for the CMS host injection
The pages carry the CMS markers (data block, list regions, JSON-LD price, inline price); PackagesProvider reads the host's data block after hydration and asks the API only when there is none; the site address comes from the block. A stand-in for the host (config/hostInjector.ts, --cms-data in the preview server) and browser tests check the behaviour with different data. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Box, Flex } from '@chakra-ui/react';
|
||||
import CmsRegion from '@/components/CmsRegion/CmsRegion';
|
||||
import DeferredImage from '@/components/DeferredImage/DeferredImage';
|
||||
import PageSection from '@/components/PageSection/PageSection';
|
||||
import Reveal from '@/components/Reveal/Reveal';
|
||||
@@ -9,6 +10,7 @@ import type {
|
||||
PricingPackage,
|
||||
PricingTopBanner,
|
||||
} from '@/content/types';
|
||||
import { bannerHtml, offeringsHtml } from '@/lib/cmsHtml';
|
||||
import { visiblePackages } from '@/lib/visiblePackages';
|
||||
import PriceBanner from './PriceBanner';
|
||||
import PriceCard from './PriceCard';
|
||||
@@ -77,44 +79,59 @@ export default function Pricing({
|
||||
lead={content.lead}
|
||||
/>
|
||||
</Reveal>
|
||||
{topBanner && (
|
||||
<Reveal>
|
||||
<PriceTopBar banner={topBanner} />
|
||||
</Reveal>
|
||||
)}
|
||||
{/* Packages and banners are CMS data: the CMS host may rewrite
|
||||
them in the HTML it sends (CmsRegion), so they are plain
|
||||
HTML until the page has hydrated */}
|
||||
<CmsRegion
|
||||
name="BANNER-TOP-HTML"
|
||||
html={bannerHtml(topBanner ?? null)}
|
||||
>
|
||||
{topBanner && (
|
||||
<Reveal>
|
||||
<PriceTopBar banner={topBanner} />
|
||||
</Reveal>
|
||||
)}
|
||||
</CmsRegion>
|
||||
{/* Wrapping flex, not a grid: a grid leaves the last row at
|
||||
the left. Every card is exactly a third of the row minus
|
||||
the gaps, so the cards of a full row line up and an
|
||||
incomplete last row is centred. */}
|
||||
<Flex
|
||||
direction={{ base: 'column', lg: 'row' }}
|
||||
wrap={{ base: 'nowrap', lg: 'wrap' }}
|
||||
justify="center"
|
||||
gap="gridGap"
|
||||
maxW={{ base: '460px', lg: 'none' }}
|
||||
mx="auto"
|
||||
<CmsRegion name="OFFERINGS-HTML" html={offeringsHtml(shown)}>
|
||||
<Flex
|
||||
direction={{ base: 'column', lg: 'row' }}
|
||||
wrap={{ base: 'nowrap', lg: 'wrap' }}
|
||||
justify="center"
|
||||
gap="gridGap"
|
||||
maxW={{ base: '460px', lg: 'none' }}
|
||||
mx="auto"
|
||||
>
|
||||
{shown.map((pkg, index) => (
|
||||
<Reveal
|
||||
key={pkg.id}
|
||||
delay={index * STAGGER}
|
||||
w={{
|
||||
base: '100%',
|
||||
lg: 'calc((100% - 2 * {spacing.gridGap}) / 3)',
|
||||
}}
|
||||
>
|
||||
<PriceCard pkg={pkg} />
|
||||
</Reveal>
|
||||
))}
|
||||
</Flex>
|
||||
</CmsRegion>
|
||||
<CmsRegion
|
||||
name="BANNER-BOTTOM-HTML"
|
||||
html={bannerHtml(banner ?? null)}
|
||||
>
|
||||
{shown.map((pkg, index) => (
|
||||
<Reveal
|
||||
key={pkg.id}
|
||||
delay={index * STAGGER}
|
||||
w={{
|
||||
base: '100%',
|
||||
lg: 'calc((100% - 2 * {spacing.gridGap}) / 3)',
|
||||
}}
|
||||
>
|
||||
<PriceCard pkg={pkg} />
|
||||
{banner && (
|
||||
<Reveal>
|
||||
<PriceBanner
|
||||
banner={banner}
|
||||
decoration={content.decorations[0]}
|
||||
/>
|
||||
</Reveal>
|
||||
))}
|
||||
</Flex>
|
||||
{banner && (
|
||||
<Reveal>
|
||||
<PriceBanner
|
||||
banner={banner}
|
||||
decoration={content.decorations[0]}
|
||||
/>
|
||||
</Reveal>
|
||||
)}
|
||||
)}
|
||||
</CmsRegion>
|
||||
</Box>
|
||||
</PageSection>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user