src/components/cta/CTAUrgent.astro
---
/**
* CTAUrgent
* CTA met urgentie/schaarste signalen (beperkt aanbod, deadline).
*/
interface Props {
urgencyLabel?: string;
headline: string;
sub?: string;
primary: { label: string; href: string };
spotsLeft?: number;
deadlineText?: string;
}
const { urgencyLabel = '⚡ Beperkt beschikbaar', headline, sub, primary, spotsLeft, deadlineText } = Astro.props;
---
<section class="ctaurg">
<div class="ctaurg-inner">
<span class="ctaurg-urgency">{urgencyLabel}</span>
<h2 class="ctaurg-headline">{headline}</h2>
{sub && <p class="ctaurg-sub">{sub}</p>}
{(spotsLeft !== undefined || deadlineText) && (
<div class="ctaurg-signals">
{spotsLeft !== undefined && (
<div class="ctaurg-signal">
<div class="ctaurg-bar">
<div class="ctaurg-bar-fill" style={`width: ${Math.min((spotsLeft/20)*100,100)}%`}></div>
</div>
<span class="ctaurg-spots">Nog <strong>{spotsLeft}</strong> plekken beschikbaar</span>
</div>
)}
{deadlineText && <p class="ctaurg-deadline">🕐 {deadlineText}</p>}
</div>
)}
<a href={primary.href} class="ctaurg-btn">{primary.label} →</a>
</div>
</section>
<style>
.ctaurg { background: #fff7ed; border: 1px solid #fed7aa; padding: 4rem 2rem; }
.ctaurg-inner { max-width: 640px; margin: 0 auto; text-align: center; }
.ctaurg-urgency { display: inline-block; padding: 0.3125rem 0.875rem; background: #ff6b35; color: #fff; font-size: 0.8125rem; font-weight: 700; border-radius: 2rem; margin-bottom: 1.5rem; }
.ctaurg-headline { font-size: clamp(1.75rem, 3.5vw, 2.5rem); font-weight: 900; color: #0a0a0a; letter-spacing: -0.04em; line-height: 1.15; margin: 0 0 0.875rem; }
.ctaurg-sub { font-size: 1.0625rem; color: #6b7280; line-height: 1.65; margin: 0 0 1.75rem; }
.ctaurg-signals { margin-bottom: 2rem; display: flex; flex-direction: column; gap: 0.875rem; align-items: center; }
.ctaurg-signal { width: 100%; max-width: 400px; }
.ctaurg-bar { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin-bottom: 0.375rem; }
.ctaurg-bar-fill { height: 100%; background: linear-gradient(90deg, #10b981, #059669); border-radius: 4px; }
.ctaurg-spots { font-size: 0.875rem; color: #374151; }
.ctaurg-deadline { font-size: 0.875rem; color: #92400e; font-weight: 500; margin: 0; }
.ctaurg-btn { display: inline-flex; align-items: center; padding: 0.9375rem 2.5rem; background: #0a0a0a; color: #fff; font-weight: 700; font-size: 1rem; border-radius: 0.5rem; text-decoration: none; transition: opacity 0.2s; }
.ctaurg-btn:hover { opacity: 0.85; }
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
headline * | string | — | Hoofd CTA tekst |
primary * | { label: string; href: string } | — | Primaire knop |
urgencyLabel | string | — | Urgentielabel (badge) |
sub | string | — | Ondertitel |
spotsLeft | number | — | Aantal resterende plekken (toont progressiebalk) |
deadlineText | string | — | Deadline tekst |
* = verplicht