Zoeken...  ⌘K GitHub

VideoStats video

Video met statistieken overlay.

/video-stats
src/components/video/VideoStats.astro
---
interface VideoStat {
  value: string;
  label: string;
  icon?: string;
}

interface Props {
  poster?: string;
  title?: string;
  stats?: VideoStat[];
}

const {
  poster = '',
  title = 'BLURR YouTube kanaal',
  stats = [
    { value: '24K', label: 'Views', icon: '👁' },
    { value: '1.2K', label: 'Abonnees', icon: '🔔' },
    { value: '8.4%', label: 'Engagement', icon: '💬' },
    { value: '4:32', label: 'Gem. kijktijd', icon: '⏱' },
  ],
} = Astro.props;
---

<div class="vst">
  <div class="vst__player">
    {poster ? (
      <img class="vst__poster" src={poster} alt={title} />
    ) : (
      <div class="vst__placeholder" aria-label={title}>
        <svg width="44" height="44" viewBox="0 0 44 44">
          <circle cx="22" cy="22" r="22" fill="rgba(99,102,241,0.85)"/>
          <polygon points="17,11 37,22 17,33" fill="#fff"/>
        </svg>
      </div>
    )}
    <span class="vst__badge">Live statistieken</span>
  </div>
  <div class="vst__stats">
    {stats.map((s) => (
      <div class="vst__stat">
        {s.icon && <span class="vst__stat-icon" aria-hidden="true">{s.icon}</span>}
        <span class="vst__stat-value">{s.value}</span>
        <span class="vst__stat-label">{s.label}</span>
      </div>
    ))}
  </div>
  <p class="vst__title">{title}</p>
</div>

<style>
  :root {
    --color-accent: #6366f1;
    --color-primary: #0a0a0a;
  }
  .vst {
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
  }
  .vst__player {
    position: relative;
    aspect-ratio: 16/9;
  }
  .vst__poster { width: 100%; height: 100%; object-fit: cover; }
  .vst__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .vst__badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
  }
  .vst__stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid #eee;
  }
  .vst__stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    gap: 0.2rem;
    border-right: 1px solid #eee;
  }
  .vst__stat:last-child { border-right: none; }
  .vst__stat-icon { font-size: 1rem; }
  .vst__stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-primary, #0a0a0a);
    line-height: 1;
  }
  .vst__stat-label {
    font-size: 0.7rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
  }
  .vst__title {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary, #0a0a0a);
    margin: 0;
    border-top: 1px solid #eee;
  }
  @media (max-width: 480px) {
    .vst__stats { grid-template-columns: repeat(2, 1fr); }
    .vst__stat:nth-child(2) { border-right: none; }
  }
</style>

Props

Prop Type Default Beschrijving
poster string Thumbnail
title string Videotitel

* = verplicht