Makes the price banner lighter and richer in the ASF style
White band like the price cards (a light green tone stays available), a thin heidegroen rule, the section-heading type in spaced capitals, a small ornament, the eucalyptus sprig in a corner and more space. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,19 +1,38 @@
|
|||||||
import { Box, Heading, Text, useRecipe } from '@chakra-ui/react';
|
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 = {
|
type PriceBannerProps = {
|
||||||
banner: PricingBanner;
|
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
|
// 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
|
// offer, a notice), in the ASF look: light, a thin heidegroen rule on top,
|
||||||
// alternate paper tone with a hairline, a thin heidegroen rule on top, the
|
// the section-heading type (Marcellus in spaced capitals), a small ornament
|
||||||
// heading font and, when there is a link, the deep-green button of the cards'
|
// between title and text, the botanical sprig in a corner and, when there is
|
||||||
// family. It is not a bookable package and cannot be dismissed. Only the
|
// a link, the deep-green button of the cards. It is not a bookable package
|
||||||
// title is required; the text and the button are left out when empty. The
|
// and cannot be dismissed. Only the title is required; the text and the
|
||||||
// link is a https address or a path on this site (the CMS guarantees that,
|
// button are left out when empty. The link is a https address or a path on
|
||||||
// mapBanner checks it again), so a plain anchor is enough.
|
// this site (the CMS guarantees that, mapBanner checks it again), so a plain
|
||||||
export default function PriceBanner({ banner }: PriceBannerProps) {
|
// anchor is enough.
|
||||||
|
export default function PriceBanner({
|
||||||
|
banner,
|
||||||
|
decoration,
|
||||||
|
tone = 'white',
|
||||||
|
}: PriceBannerProps) {
|
||||||
const linkButton = useRecipe({ key: 'linkButton' });
|
const linkButton = useRecipe({ key: 'linkButton' });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -21,26 +40,59 @@ export default function PriceBanner({ banner }: PriceBannerProps) {
|
|||||||
as="aside"
|
as="aside"
|
||||||
aria-labelledby="price-banner-title"
|
aria-labelledby="price-banner-title"
|
||||||
data-testid="price-banner"
|
data-testid="price-banner"
|
||||||
|
data-tone={tone}
|
||||||
|
position="relative"
|
||||||
|
overflow="hidden"
|
||||||
|
isolation="isolate"
|
||||||
mt="gridGap"
|
mt="gridGap"
|
||||||
px="clamp(1.5rem, 4vw, 3.5rem)"
|
px="clamp(1.75rem, 6vw, 5rem)"
|
||||||
py="clamp(2rem, 4vw, 3rem)"
|
py="clamp(2.75rem, 5vw, 4.25rem)"
|
||||||
bg="paper.alt"
|
bg={TONES[tone].bg}
|
||||||
borderWidth="1px"
|
borderWidth="1px"
|
||||||
borderColor="line"
|
borderColor="line"
|
||||||
borderTopWidth="3px"
|
borderTopWidth="3px"
|
||||||
borderTopColor="accent"
|
borderTopColor="accent"
|
||||||
textAlign="center"
|
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
|
<Heading
|
||||||
as="h3"
|
as="h3"
|
||||||
id="price-banner-title"
|
id="price-banner-title"
|
||||||
fontSize="1.5rem"
|
textStyle="sectionHeading"
|
||||||
mb={banner.text ? 3 : 0}
|
maxW="720px"
|
||||||
|
mx="auto"
|
||||||
>
|
>
|
||||||
{banner.title}
|
{banner.title}
|
||||||
</Heading>
|
</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 && (
|
{banner.text && (
|
||||||
<Text color="ink.soft" maxW="560px" mx="auto">
|
<Text textStyle="lead" color="ink.soft" maxW="560px" mx="auto">
|
||||||
{banner.text}
|
{banner.text}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
@@ -49,7 +101,7 @@ export default function PriceBanner({ banner }: PriceBannerProps) {
|
|||||||
asChild
|
asChild
|
||||||
css={linkButton({ variant: 'accent', size: 'fit' })}
|
css={linkButton({ variant: 'accent', size: 'fit' })}
|
||||||
display="inline-flex"
|
display="inline-flex"
|
||||||
mt={6}
|
mt={8}
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href={banner.link.url}
|
href={banner.link.url}
|
||||||
|
|||||||
@@ -81,7 +81,10 @@ export default function Pricing({ content, packages, banner }: PricingProps) {
|
|||||||
</Grid>
|
</Grid>
|
||||||
{banner && (
|
{banner && (
|
||||||
<Reveal>
|
<Reveal>
|
||||||
<PriceBanner banner={banner} />
|
<PriceBanner
|
||||||
|
banner={banner}
|
||||||
|
decoration={content.decorations[0]}
|
||||||
|
/>
|
||||||
</Reveal>
|
</Reveal>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user