src/components/hero/HeroFullscreen.astro
---
/**
* HeroFullscreen
* 100vh hero met achtergrondafbeelding of -video en overlay.
*
* Props:
* - headline: string
* - sub?: string
* - ctaPrimary?: { label: string; href: string }
* - bg: string — URL naar image of video
* - bgType?: 'image' | 'video'
* - overlayOpacity?: number — 0-1, default 0.5
* - align?: 'center' | 'left'
*/
interface Props {
headline: string;
sub?: string;
ctaPrimary?: { label: string; href: string };
bg: string;
bgType?: 'image' | 'video';
overlayOpacity?: number;
align?: 'center' | 'left';
}
const {
headline,
sub,
ctaPrimary,
bg,
bgType = 'image',
overlayOpacity = 0.5,
align = 'center',
} = Astro.props;
---
<section class={`hero-fs hero-fs--${align}`} data-hero-fs>
{bgType === 'image' ? (
<img src={bg} alt="" class="hero-fs__bg" aria-hidden="true" />
) : (
<video class="hero-fs__bg" autoplay muted loop playsinline aria-hidden="true">
<source src={bg} />
</video>
)}
<div class="hero-fs__overlay" style={`opacity: ${overlayOpacity}`}></div>
<div class="hero-fs__inner">
<h1 class="hero-fs__headline">{headline}</h1>
{sub && <p class="hero-fs__sub">{sub}</p>}
{ctaPrimary && (
<a href={ctaPrimary.href} class="hero-fs__cta">{ctaPrimary.label}</a>
)}
</div>
<div class="hero-fs__scroll-hint" aria-hidden="true">
<span></span>
</div>
</section>
<style>
.hero-fs {
position: relative;
width: 100%;
height: 100svh;
min-height: 560px;
display: flex;
align-items: center;
overflow: hidden;
color: #fff;
}
.hero-fs__bg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.hero-fs__overlay {
position: absolute;
inset: 0;
background: var(--color-primary);
}
.hero-fs__inner {
position: relative;
z-index: 1;
width: 100%;
max-width: 1280px;
margin: 0 auto;
padding: 0 1.5rem;
}
.hero-fs--center .hero-fs__inner {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
}
.hero-fs__headline {
font-size: clamp(2.5rem, 6vw, 5rem);
font-weight: 900;
line-height: 1.05;
letter-spacing: -0.04em;
margin: 0 0 1.25rem;
max-width: 900px;
}
.hero-fs__sub {
font-size: clamp(1rem, 2vw, 1.3125rem);
opacity: 0.8;
max-width: 560px;
margin: 0 0 2.5rem;
line-height: 1.6;
}
.hero-fs__cta {
display: inline-flex;
padding: 0.875rem 2rem;
background: var(--color-accent);
color: #fff;
border-radius: var(--radius);
font-weight: 700;
font-size: 1rem;
text-decoration: none;
transition: opacity 0.2s, transform 0.2s;
}
.hero-fs__cta:hover { opacity: 0.85; transform: translateY(-2px); }
.hero-fs__scroll-hint {
position: absolute;
bottom: 2rem;
left: 50%;
transform: translateX(-50%);
z-index: 1;
}
.hero-fs__scroll-hint span {
display: block;
width: 2px;
height: 48px;
background: linear-gradient(to bottom, rgba(255,255,255,0.7), transparent);
animation: scrollHint 1.6s ease-in-out infinite;
}
@keyframes scrollHint {
0%, 100% { transform: scaleY(1) translateY(0); opacity: 1; }
50% { transform: scaleY(0.6) translateY(8px); opacity: 0.4; }
}
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
headline * | string | — | H1 tekst |
bg * | string | — | URL naar achtergrondafbeelding of video |
sub | string | — | Ondertitel |
ctaPrimary | { label: string; href: string } | — | CTA knop |
bgType | 'image' | 'video' | 'image' | Type achtergrond |
overlayOpacity | number | 0.5 | Overlay donkerte 0-1 |
align | 'center' | 'left' | 'center' | Tekstuitlijning |
* = verplicht