ImageFullscreen image
Fullscreen hero op 100vh met foto of kleurenachtergrond, overlay, kop, body en CTA.
src/components/image/ImageFullscreen.astro
---
interface Props {
src?: string;
alt?: string;
eyebrow?: string;
title: string;
body?: string;
cta?: { label: string; href: string };
}
const {
src,
alt = 'Achtergrondafbeelding',
eyebrow,
title,
body,
cta,
} = Astro.props;
---
<section class="bl-section ifs">
{src
? <img data-allow-img class="ifs__bg" src={src} alt={alt} loading="lazy" decoding="async" />
: <div class="ifs__placeholder" aria-label={alt}></div>
}
<div class="ifs__overlay">
<div class="bl-inner ifs__content">
{eyebrow && <p class="ifs__eyebrow">{eyebrow}</p>}
<h2 class="ifs__title">{title}</h2>
{body && <p class="ifs__body">{body}</p>}
{cta && <a class="ifs__cta" href={cta.href}>{cta.label}</a>}
</div>
</div>
</section>
<style>
.ifs {
position: relative;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
overflow: hidden;
padding-block: 0;
}
.ifs__bg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.ifs__placeholder {
position: absolute;
inset: 0;
background: linear-gradient(160deg, #0f0f1a, #1a1a3a 60%, #0d0d2b);
}
.ifs__overlay {
position: absolute;
inset: 0;
background: rgba(10, 10, 10, 0.55);
display: flex;
align-items: center;
}
.ifs__content {
padding-block: var(--bl-section-py);
}
.ifs__eyebrow {
font-size: 0.8rem;
font-weight: 700;
letter-spacing: 0.15em;
text-transform: uppercase;
color: var(--color-accent, #6366f1);
margin: 0 0 1rem;
}
.ifs__title {
font-size: clamp(2.5rem, 6vw, 5rem);
font-weight: 900;
color: #fff;
margin: 0 0 1.25rem;
line-height: 1.05;
max-width: 800px;
}
.ifs__body {
font-size: 1.15rem;
color: #e8e8e8;
margin: 0 0 2.5rem;
line-height: 1.6;
max-width: 580px;
}
.ifs__cta {
display: inline-block;
padding: 1rem 2.5rem;
background: var(--color-accent, #6366f1);
color: #fff;
text-decoration: none;
border-radius: 8px;
font-weight: 700;
font-size: 1rem;
transition: transform 0.2s, opacity 0.2s;
}
.ifs__cta:hover {
transform: translateY(-2px);
opacity: 0.9;
}
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
src | string | - | URL van de achtergrondafbeelding |
alt | string | "Achtergrondafbeelding" | Alt-tekst |
eyebrow | string | - | Kleine bovenste tekstregel boven de kop |
title * | string | - | Hoofdkop |
body | string | - | Bodytekst onder de kop |
cta | { label: string; href: string } | - | CTA-knop |
* = verplicht