Zoeken...  ⌘K GitHub

ListStats list

Horizontale rij statistieken: grote waarde, label en optionele context. Geschikt als social proof. Light of dark.

/list-stats
src/components/list/ListStats.astro
---
/**
 * ListStats
 * Horizontale rij met statistieken: grote waarde, label, optionele beschrijving.
 * Grid-conform: stats altijd in de .bl-inner rail.
 *
 * Props:
 * - items: Array<{ value: string; label: string; desc?: string }>
 * - theme?: 'light' | 'dark'   default 'light'
 */
interface Props {
  items: { value: string; label: string; desc?: string }[];
  theme?: 'light' | 'dark';
}

const {
  items,
  theme = 'light',
} = Astro.props;
---

<section class:list={['bl-section', 'lst-stat-section', `lst-stat-section--${theme}`]}>
  <div class="bl-inner">
    <ul class="lst-stat">
      {items.map(({ value, label, desc }) => (
        <li class="lst-stat__item">
          <span class="lst-stat__value">{value}</span>
          <strong class="lst-stat__label">{label}</strong>
          {desc && <span class="lst-stat__desc">{desc}</span>}
        </li>
      ))}
    </ul>
  </div>
</section>

<style>
.lst-stat-section--dark { background: #0a0a0a; }

.lst-stat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0;
  background: #efefef;
  border: 1px solid #efefef;
  border-radius: .75rem;
  overflow: hidden;
}

.lst-stat-section--dark .lst-stat {
  background: #222;
  border-color: #333;
}

.lst-stat__item {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: 1.75rem 1.5rem;
  background: #fff;
}

.lst-stat-section--dark .lst-stat__item {
  background: #111;
}

.lst-stat__value {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 900;
  color: var(--color-accent);
  line-height: 1;
  letter-spacing: -.04em;
}

.lst-stat__label {
  font-size: .9rem;
  font-weight: 700;
  color: var(--color-primary, #0a0a0a);
}

.lst-stat-section--dark .lst-stat__label {
  color: #e8e8e8;
}

.lst-stat__desc {
  font-size: .825rem;
  color: #555;
  line-height: 1.4;
}

.lst-stat-section--dark .lst-stat__desc {
  color: #aaa;
}
</style>

Props

Prop Type Default Beschrijving
items * Array<{ value: string; label: string; desc?: string }> - Statistieken: waarde, label en optionele beschrijving
theme 'light' | 'dark' 'light' Achtergrond-mode

* = verplicht