Files
SlpSoftware/src/features/landing/components/PackageCard.tsx
T

66 lines
2.4 KiB
TypeScript

import type { PackageCardData } from '../data/content';
import { handleAnchorClick } from '../../../utils/scrollToHash';
import { useContactPreselect } from '../../../shared/contact/useContactPreselect';
/** Package card of design B: flat block, featured package in the brand colour with a badge. */
export function PackageCard({ pkg }: { pkg: PackageCardData }) {
const { select } = useContactPreselect();
const featured = Boolean(pkg.featured);
return (
<article
className={`relative flex h-full flex-col px-6 pb-8 pt-9 sm:px-9 sm:pb-9 sm:pt-10 ${
featured ? 'bg-brand text-on-brand' : 'bg-surface-2 text-text'
}`}
data-testid={`package-card-${pkg.id}`}
>
{featured && (
<span className="absolute right-0 top-0 bg-[#0e0d0d] px-3.5 py-2 text-[13px] font-bold text-white">
Meest gekozen
</span>
)}
<h3 className="mb-2.5 hyphens-auto text-[clamp(24px,6.6vw,30px)] font-extrabold leading-[1.05] tracking-[-0.02em] [font-stretch:112%] [overflow-wrap:anywhere]">
{pkg.title}
</h3>
<p className={`mb-9 text-base ${featured ? 'text-on-brand' : 'text-muted'}`}>
{pkg.description}
</p>
<div className="text-[clamp(40px,4vw,54px)] font-extrabold leading-none tracking-[-0.03em] [font-stretch:125%]">
{pkg.price}
</div>
<div className={`mt-2 text-sm ${featured ? 'text-on-brand' : 'text-muted'}`}>
{pkg.priceNote}
</div>
<ul className="my-8 flex-1 list-none p-0 text-[15px]">
{pkg.features.map((feature) => (
<li
key={feature}
className={`flex gap-3 border-t py-[9px] ${featured ? 'border-white/30' : 'border-line'}`}
>
<span
aria-hidden="true"
className={`mt-[9px] h-[7px] w-[7px] flex-none ${featured ? 'bg-white' : 'bg-accent'}`}
/>
<span>{feature}</span>
</li>
))}
</ul>
<a
href="#contact"
onClick={(event) => {
select(pkg.slug);
handleAnchorClick(event, '#contact');
}}
className={`block px-5 py-4 text-center text-base font-bold no-underline transition-colors ${
featured
? 'bg-white text-[#0e0d0d] hover:bg-inv hover:text-white'
: 'bg-text text-bg hover:bg-brand hover:text-on-brand'
}`}
data-testid={`package-cta-${pkg.id}`}
>
{pkg.ctaLabel}
</a>
</article>
);
}