src/components/video/VideoAutoplay.astro
---
/**
* VideoAutoplay
* Volledige breedte gedempt autoplay-video als achtergrond sectie
*/
interface Props {
src?: string;
headline?: string;
overlay?: boolean;
}
const {
src = 'https://www.w3schools.com/html/mov_bbb.mp4',
headline = 'Resultaten die voor zich spreken',
overlay = true,
} = Astro.props;
---
<section class="vap">
<div class="vap__video-wrap">
<video
class="vap__video"
src={src}
autoplay
muted
loop
playsinline
aria-hidden="true"
></video>
{overlay && <div class="vap__overlay"></div>}
</div>
{headline && (
<div class="vap__content">
<h2 class="vap__headline">{headline}</h2>
</div>
)}
</section>
<style>
.vap {
position: relative;
width: 100%;
min-height: 520px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.vap__video-wrap {
position: absolute;
inset: 0;
}
.vap__video {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.vap__overlay {
position: absolute;
inset: 0;
background: rgba(10, 10, 10, 0.55);
}
.vap__content {
position: relative;
z-index: 1;
text-align: center;
padding: 2rem 1.5rem;
}
.vap__headline {
font-size: clamp(1.75rem, 4vw, 3.5rem);
font-weight: 800;
color: #fff;
margin: 0;
line-height: 1.15;
letter-spacing: -0.02em;
text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
src | string | — | Video URL |
headline | string | — | Overlay headline |
overlay | boolean | — | Donkere overlay tonen |
* = verplicht