src/components/image/ImageHero.astro
---
interface Props {
src?: string;
alt?: string;
title?: string;
subtitle?: string;
height?: string;
}
const {
src = '',
alt = 'Hero afbeelding',
title = 'Resultaten die spreken voor zich',
subtitle = 'Van strategie tot uitvoering — wij bouwen merken die groeien.',
height = '80vh',
} = Astro.props;
---
<section class="ih" style={`--ih-height: ${height}`}>
{src ? (
<img class="ih__img" src={src} alt={alt} />
) : (
<div class="ih__placeholder" aria-label={alt}></div>
)}
<div class="ih__overlay">
<div class="ih__content">
<h1 class="ih__title">{title}</h1>
<p class="ih__subtitle">{subtitle}</p>
</div>
</div>
</section>
<style>
:root {
--color-accent: #6366f1;
--color-primary: #0a0a0a;
}
.ih {
position: relative;
width: 100%;
height: var(--ih-height, 80vh);
overflow: hidden;
}
.ih__img {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
object-position: center;
}
.ih__placeholder {
position: absolute;
inset: 0;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.ih__overlay {
position: absolute;
inset: 0;
background: linear-gradient(to top, rgba(10,10,10,0.7) 0%, rgba(10,10,10,0.2) 60%, transparent 100%);
display: flex;
align-items: flex-end;
padding: 3rem;
}
.ih__content { max-width: 720px; }
.ih__title {
font-size: clamp(2rem, 5vw, 4rem);
font-weight: 800;
color: #fff;
margin: 0 0 1rem;
line-height: 1.1;
}
.ih__subtitle {
font-size: clamp(1rem, 2vw, 1.25rem);
color: rgba(255,255,255,0.85);
margin: 0;
line-height: 1.6;
}
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
src | string | — | Afbeelding URL |
alt | string | — | Alt-tekst |
title | string | — | Koptitel |
subtitle | string | — | Subtitel |
height | string | — | Hoogte van de sectie (CSS-waarde) |
* = verplicht