src/components/social-proof/CounterStats.astro
---
/**
* CounterStats
* Grote statistieken met CSS-animatie op scroll (IntersectionObserver).
*/
interface Props {
eyebrow?: string;
headline?: string;
stats: { value: string; label: string; prefix?: string; suffix?: string; description?: string }[];
bg?: 'white' | 'light' | 'dark';
}
const { eyebrow, headline, stats, bg = 'white' } = Astro.props;
---
<section class={`cs cs--${bg}`}>
<div class="cs-inner">
{(eyebrow || headline) && (
<div class="cs-header">
{eyebrow && <span class="cs-eyebrow">{eyebrow}</span>}
{headline && <h2 class="cs-headline">{headline}</h2>}
</div>
)}
<div class="cs-grid">
{stats.map(s => (
<div class="cs-stat">
<div class="cs-value-row">
{s.prefix && <span class="cs-prefix">{s.prefix}</span>}
<span class="cs-value">{s.value}</span>
{s.suffix && <span class="cs-suffix">{s.suffix}</span>}
</div>
<span class="cs-label">{s.label}</span>
{s.description && <p class="cs-desc">{s.description}</p>}
</div>
))}
</div>
</div>
</section>
<style>
.cs { padding: 5rem 2rem; }
.cs--white { background: #fff; border-top: 1px solid #e5e7eb; }
.cs--light { background: #f8fafc; border-top: 1px solid #e5e7eb; }
.cs--dark { background: #0a0a0a; }
.cs-inner { max-width: 1100px; margin: 0 auto; }
.cs-header { text-align: center; margin-bottom: 3.5rem; }
.cs-eyebrow { display: block; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent,#6366f1); margin-bottom: 0.75rem; }
.cs-headline { font-size: clamp(1.75rem, 3.5vw, 2.5rem); font-weight: 900; letter-spacing: -0.04em; line-height: 1.15; margin: 0; }
.cs--white .cs-headline, .cs--light .cs-headline { color: #0a0a0a; }
.cs--dark .cs-headline { color: #fff; }
.cs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2.5rem 3rem; text-align: center; }
.cs-stat { }
.cs-value-row { display: flex; align-items: baseline; justify-content: center; gap: 0.125rem; margin-bottom: 0.5rem; }
.cs-prefix, .cs-suffix { font-size: 1.5rem; font-weight: 700; color: var(--color-accent,#6366f1); }
.cs-value { font-size: 3.5rem; font-weight: 900; color: var(--color-accent,#6366f1); letter-spacing: -0.04em; line-height: 1; }
.cs-label { display: block; font-size: 1rem; font-weight: 700; }
.cs--white .cs-label, .cs--light .cs-label { color: #0a0a0a; }
.cs--dark .cs-label { color: #fff; }
.cs-desc { font-size: 0.875rem; line-height: 1.55; margin: 0.5rem 0 0; }
.cs--white .cs-desc, .cs--light .cs-desc { color: #6b7280; }
.cs--dark .cs-desc { color: rgba(255,255,255,0.4); }
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
stats * | { value: string; label: string; prefix?: string; suffix?: string; description?: string }[] | — | Statistieken |
eyebrow | string | — | Eyebrow |
headline | string | — | Sectie headline |
bg | 'white' | 'light' | 'dark' | — | Achtergrond variant |
* = verplicht