Zoeken...  ⌘K GitHub

IconHero icon

Hero met decoratief iconen-patroon op de achtergrond, gradient-overlay, grote kop en CTA-knop.

/icon-hero
src/components/icon/IconHero.astro
---
interface BgIcon {
  icon: string;
}

interface Props {
  title: string;
  subtitle?: string;
  cta?: { label: string; href: string };
  bgIcons?: BgIcon[];
}

const {
  title,
  subtitle,
  cta,
  bgIcons = [],
} = Astro.props;
---

<section class:list={['bl-section', 'ihr-section']}>
  <div class="bl-inner">
    <div class="ihr">
      {bgIcons.length > 0 && (
        <div class="ihr__bg-icons" aria-hidden="true">
          {bgIcons.map(b => <span class="ihr__bg-icon">{b.icon}</span>)}
        </div>
      )}
      <div class="ihr__overlay">
        <div class="ihr__content">
          <h1 class="ihr__title">{title}</h1>
          {subtitle && <p class="ihr__subtitle">{subtitle}</p>}
          {cta && <a class="ihr__cta" href={cta.href}>{cta.label}</a>}
        </div>
      </div>
    </div>
  </div>
</section>

<style>
  .ihr-section { background: var(--color-bg, #fff); }
  .ihr {
    position: relative;
    min-height: 480px;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
  }
  .ihr__bg-icons {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
  }
  .ihr__bg-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    opacity: .12;
    padding: 1.5rem;
    filter: grayscale(.5);
  }
  .ihr__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #6366f114, #ffffffe6 60%);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .ihr__content { text-align: center; z-index: 1; padding: 2rem; }
  .ihr__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    color: var(--color-primary, #0a0a0a);
    margin: 0 0 1rem;
    line-height: 1.1;
  }
  .ihr__subtitle { font-size: 1.1rem; color: #555; margin: 0 0 2rem; line-height: 1.6; }
  .ihr__cta {
    display: inline-block;
    padding: .9rem 2.25rem;
    background: var(--color-accent, #6366f1);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    transition: transform .2s, opacity .2s;
  }
  .ihr__cta:hover { transform: translateY(-2px); opacity: .9; }
</style>

Props

Prop Type Default Beschrijving
title * string - H1-kop
subtitle string - Ondertitel
cta { label: string; href: string } - CTA-knop
bgIcons { icon: string }[] - Decoratieve iconen voor de achtergrond-grid (aanbevolen: 12)

* = verplicht