src/components/image/ImagePolaroid.astro
---
interface PolaroidImage {
src?: string;
alt: string;
caption: string;
rotation?: number;
}
interface Props {
images?: PolaroidImage[];
title?: string;
}
const {
images = [
{ alt: 'Teamfoto 1', caption: 'Kick-off 2024', rotation: -3 },
{ alt: 'Teamfoto 2', caption: 'Creatieve sessie', rotation: 2 },
{ alt: 'Teamfoto 3', caption: 'Awards avond', rotation: -1 },
{ alt: 'Teamfoto 4', caption: 'Klant lunch', rotation: 3 },
],
title = 'Achter de schermen',
} = Astro.props;
---
<section class="ipo">
{title && <h2 class="ipo__title">{title}</h2>}
<div class="ipo__row">
{images.map((img) => (
<figure class="ipo__card" style={`--ipo-rot: ${img.rotation ?? 0}deg`}>
<div class="ipo__media">
{img.src ? (
<img class="ipo__img" src={img.src} alt={img.alt} />
) : (
<div class="ipo__placeholder" aria-label={img.alt}></div>
)}
</div>
<figcaption class="ipo__caption">{img.caption}</figcaption>
</figure>
))}
</div>
</section>
<style>
:root {
--color-accent: #6366f1;
--color-primary: #0a0a0a;
}
.ipo { padding: 3rem 0; }
.ipo__title {
font-size: 2rem;
font-weight: 700;
color: var(--color-primary, #0a0a0a);
text-align: center;
margin: 0 0 3rem;
}
.ipo__row {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 2rem;
padding: 1rem;
}
.ipo__card {
width: 200px;
background: #fff;
padding: 1rem 1rem 2.5rem;
box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 1px 4px rgba(0,0,0,0.1);
transform: rotate(var(--ipo-rot, 0deg));
transition: transform 0.25s, box-shadow 0.25s;
cursor: pointer;
margin: 0;
}
.ipo__card:hover {
transform: rotate(0deg) scale(1.05);
box-shadow: 0 10px 40px rgba(0,0,0,0.2);
z-index: 2;
position: relative;
}
.ipo__media {
aspect-ratio: 1;
overflow: hidden;
background: #f5f5f5;
}
.ipo__img { width: 100%; height: 100%; object-fit: cover; }
.ipo__placeholder {
width: 100%;
height: 100%;
background: linear-gradient(135deg, #e0d8d0 0%, #d0c8c0 100%);
}
.ipo__caption {
font-size: 0.85rem;
color: #555;
text-align: center;
padding-top: 0.75rem;
font-family: cursive, sans-serif;
}
@media (max-width: 640px) {
.ipo__card { width: 160px; }
}
</style>
Props
| Prop | Type | Default | Beschrijving |
|---|---|---|---|
images | { src?: string; alt: string; caption: string; rotation?: number }[] | — | Polaroid-kaartjes |
title | string | — | Sectietitel |
* = verplicht