Packages and banners from the CMS, host injection, translation files and the contact form #19
@@ -1,19 +1,38 @@
|
||||
import { Box, Heading, Text, useRecipe } from '@chakra-ui/react';
|
||||
import type { PricingBanner } from '@/content/types';
|
||||
import DeferredImage from '@/components/DeferredImage/DeferredImage';
|
||||
import type { ContentImage, PricingBanner } from '@/content/types';
|
||||
|
||||
// white: the white of the price cards; green: a very light heidegroen tint
|
||||
export type BannerTone = 'white' | 'green';
|
||||
|
||||
// What the band is made of per tone. Both stay light: ink text on them is
|
||||
// 13:1 or better and ink.soft stays above 6:1 (WCAG AA).
|
||||
const TONES: Record<BannerTone, { bg: string }> = {
|
||||
white: { bg: 'white' },
|
||||
green: { bg: 'color-mix(in srgb, {colors.accent} 14%, white)' },
|
||||
};
|
||||
|
||||
type PriceBannerProps = {
|
||||
banner: PricingBanner;
|
||||
// The eucalyptus sprig of the section, as a quiet corner decoration
|
||||
decoration?: ContentImage;
|
||||
tone?: BannerTone;
|
||||
};
|
||||
|
||||
// The optional band under the price cards: an announcement from the CMS (an
|
||||
// offer, a notice). Soft and warm like the rest of the homepage: the
|
||||
// alternate paper tone with a hairline, a thin heidegroen rule on top, the
|
||||
// heading font and, when there is a link, the deep-green button of the cards'
|
||||
// family. It is not a bookable package and cannot be dismissed. Only the
|
||||
// title is required; the text and the button are left out when empty. The
|
||||
// link is a https address or a path on this site (the CMS guarantees that,
|
||||
// mapBanner checks it again), so a plain anchor is enough.
|
||||
export default function PriceBanner({ banner }: PriceBannerProps) {
|
||||
// offer, a notice), in the ASF look: light, a thin heidegroen rule on top,
|
||||
// the section-heading type (Marcellus in spaced capitals), a small ornament
|
||||
// between title and text, the botanical sprig in a corner and, when there is
|
||||
// a link, the deep-green button of the cards. It is not a bookable package
|
||||
// and cannot be dismissed. Only the title is required; the text and the
|
||||
// button are left out when empty. The link is a https address or a path on
|
||||
// this site (the CMS guarantees that, mapBanner checks it again), so a plain
|
||||
// anchor is enough.
|
||||
export default function PriceBanner({
|
||||
banner,
|
||||
decoration,
|
||||
tone = 'white',
|
||||
}: PriceBannerProps) {
|
||||
const linkButton = useRecipe({ key: 'linkButton' });
|
||||
|
||||
return (
|
||||
@@ -21,26 +40,59 @@ export default function PriceBanner({ banner }: PriceBannerProps) {
|
||||
as="aside"
|
||||
aria-labelledby="price-banner-title"
|
||||
data-testid="price-banner"
|
||||
data-tone={tone}
|
||||
position="relative"
|
||||
overflow="hidden"
|
||||
isolation="isolate"
|
||||
mt="gridGap"
|
||||
px="clamp(1.5rem, 4vw, 3.5rem)"
|
||||
py="clamp(2rem, 4vw, 3rem)"
|
||||
bg="paper.alt"
|
||||
px="clamp(1.75rem, 6vw, 5rem)"
|
||||
py="clamp(2.75rem, 5vw, 4.25rem)"
|
||||
bg={TONES[tone].bg}
|
||||
borderWidth="1px"
|
||||
borderColor="line"
|
||||
borderTopWidth="3px"
|
||||
borderTopColor="accent"
|
||||
textAlign="center"
|
||||
>
|
||||
{decoration && (
|
||||
<DeferredImage
|
||||
image={decoration}
|
||||
aria-hidden="true"
|
||||
position="absolute"
|
||||
top="0"
|
||||
left="0"
|
||||
zIndex={-1}
|
||||
w="clamp(70px, 9vw, 130px)"
|
||||
h="auto"
|
||||
opacity={0.7}
|
||||
pointerEvents="none"
|
||||
/>
|
||||
)}
|
||||
<Heading
|
||||
as="h3"
|
||||
id="price-banner-title"
|
||||
fontSize="1.5rem"
|
||||
mb={banner.text ? 3 : 0}
|
||||
textStyle="sectionHeading"
|
||||
maxW="720px"
|
||||
mx="auto"
|
||||
>
|
||||
{banner.title}
|
||||
</Heading>
|
||||
{/* A hairline with a small diamond, between title and text */}
|
||||
<Box
|
||||
aria-hidden="true"
|
||||
display="flex"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
gap={3}
|
||||
my={5}
|
||||
color="accent.deep"
|
||||
>
|
||||
<Box w="clamp(36px, 8vw, 64px)" h="1px" bg="accent" />
|
||||
<Box w="7px" h="7px" bg="accent" transform="rotate(45deg)" />
|
||||
<Box w="clamp(36px, 8vw, 64px)" h="1px" bg="accent" />
|
||||
</Box>
|
||||
{banner.text && (
|
||||
<Text color="ink.soft" maxW="560px" mx="auto">
|
||||
<Text textStyle="lead" color="ink.soft" maxW="560px" mx="auto">
|
||||
{banner.text}
|
||||
</Text>
|
||||
)}
|
||||
@@ -49,7 +101,7 @@ export default function PriceBanner({ banner }: PriceBannerProps) {
|
||||
asChild
|
||||
css={linkButton({ variant: 'accent', size: 'fit' })}
|
||||
display="inline-flex"
|
||||
mt={6}
|
||||
mt={8}
|
||||
>
|
||||
<a
|
||||
href={banner.link.url}
|
||||
|
||||
@@ -81,7 +81,10 @@ export default function Pricing({ content, packages, banner }: PricingProps) {
|
||||
</Grid>
|
||||
{banner && (
|
||||
<Reveal>
|
||||
<PriceBanner banner={banner} />
|
||||
<PriceBanner
|
||||
banner={banner}
|
||||
decoration={content.decorations[0]}
|
||||
/>
|
||||
</Reveal>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user