Pakketblok: elk aantal pakketten, filterchips, swipe-rij op mobiel en optionele banner
Pure logica (splitsen, chips, filter, labels), useSwipeRow en usePackageFilter, ContactPreselect voor het formulier, kaarten in stijl B en tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,49 +1,63 @@
|
||||
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 (
|
||||
<div
|
||||
className={`relative flex flex-col rounded border p-8 transition-all hover:-translate-y-1 ${
|
||||
pkg.featured
|
||||
? 'border-accent-line bg-surface-2'
|
||||
: 'border-line bg-surface hover:border-accent-line'
|
||||
<article
|
||||
className={`relative flex h-full flex-col px-9 pb-9 pt-10 ${
|
||||
featured ? 'bg-brand text-on-brand' : 'bg-surface-2 text-text'
|
||||
}`}
|
||||
data-testid={`package-card-${pkg.id}`}
|
||||
>
|
||||
{pkg.featured && (
|
||||
<span className="font-mono absolute -top-3 left-7 rounded-full bg-accent px-3 py-1 text-[0.7rem] font-bold uppercase tracking-wide text-[var(--color-accent-contrast)]">
|
||||
{featured && (
|
||||
<span className="absolute right-0 top-0 bg-[#0e0d0d] px-3.5 py-2 text-[13px] font-bold text-white">
|
||||
Meest gekozen
|
||||
</span>
|
||||
)}
|
||||
<span className="font-mono mb-3.5 text-[0.78rem] text-accent">{pkg.slug}</span>
|
||||
<h3 className="mb-2.5 text-xl font-bold">{pkg.title}</h3>
|
||||
<p className="mb-6 text-[0.95rem] text-muted">{pkg.description}</p>
|
||||
<div className="font-mono mb-1 text-3xl font-bold">
|
||||
<h3 className="mb-2.5 text-[30px] font-extrabold leading-[1.05] tracking-[-0.02em] [font-stretch:112%]">
|
||||
{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}
|
||||
<small className="mt-0.5 block text-[0.78rem] font-normal text-muted">{pkg.priceNote}</small>
|
||||
</div>
|
||||
<ul className="my-6 flex-1 list-none">
|
||||
<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="relative mb-2.5 pl-6 text-[0.93rem] text-muted">
|
||||
<span className="font-mono absolute left-0 text-accent" aria-hidden="true">
|
||||
→
|
||||
</span>
|
||||
{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) => handleAnchorClick(event, '#contact')}
|
||||
className={`rounded-lg px-6 py-3.5 text-center text-[0.98rem] font-semibold ${
|
||||
pkg.featured
|
||||
? 'bg-accent text-[var(--color-accent-contrast)] hover:bg-[var(--color-accent-hover)]'
|
||||
: 'border border-line text-text hover:border-accent-line'
|
||||
onClick={(event) => {
|
||||
select(pkg.slug);
|
||||
handleAnchorClick(event, '#contact');
|
||||
}}
|
||||
className={`block px-5 py-4 text-center text-base font-bold no-underline hover:opacity-90 ${
|
||||
featured ? 'bg-white text-[#0e0d0d]' : 'bg-text text-bg'
|
||||
}`}
|
||||
data-testid={`package-cta-${pkg.id}`}
|
||||
>
|
||||
{pkg.ctaLabel}
|
||||
</a>
|
||||
</div>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user