ImageCinematic image
Breedbeeldafbeelding met zwarte letterboxbalken voor een filmische uitstraling.
src/components/image/ImageCinematic.astro
---
interface Props {
src?: string;
alt?: string;
caption?: string;
ratio?: string;
}
const {
src = '/img/ext/photo-1497366216548-37526070297c-w1600-7e1d26.jpg',
alt = 'Cinematische beeldopname',
caption,
ratio = '21/9',
} = Astro.props;
---
<section class="bl-section icin-section">
<div class="bl-inner">
<figure class="icin" style={`--icin-ratio: ${ratio}`}>
<div class="icin__frame">
<div class="icin__bars" aria-hidden="true"></div>
<img data-allow-img class="icin__img" src={src} alt={alt} loading="lazy" decoding="async" />
<div class="icin__overlay"></div>
<div class="icin__bars icin__bars--bottom" aria-hidden="true"></div>
</div>
{caption && <figcaption class="icin__caption">{caption}</figcaption>}
</figure>
</div>
</section>
<style>
.icin {
margin: 0;
overflow: hidden;
}
.icin__frame {
position: relative;
width: 100%;
aspect-ratio: var(--icin-ratio, 21/9);
overflow: hidden;
}
.icin__img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
filter: grayscale(20%) brightness(0.85);
}
.icin__overlay {
position: absolute;
inset: 0;
background: rgba(10, 10, 10, 0.3);
}
.icin__bars {
position: absolute;
left: 0;
right: 0;
top: 0;
height: 80px;
background: var(--color-primary, #0a0a0a);
z-index: 1;
}
.icin__bars--bottom {
top: auto;
bottom: 0;
}
.icin__caption {
display: block;
text-align: center;
font-size: 0.8rem;
color: #aaa;
font-style: italic;
margin: 0.85rem 0 0;
letter-spacing: 0.02em;
line-height: 1.6;
}
@media (max-width: 768px) {
.icin__frame {
aspect-ratio: 16/9;
}
.icin__bars {
height: 48px;
}
}
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
src | string | - | URL van de afbeelding |
alt | string | "Cinematische beeldopname" | Alt-tekst |
caption | string | - | Optioneel bijschrift onder het beeld |
ratio | string | "21/9" | Beeldverhouding (CSS aspect-ratio) |
* = verplicht