/* global React */
const { useState: useStateProj } = React;
/** Single project case — image (or mini slideshow) + info column with name/type/desc/review */
function ProjectCard({ name, italic, type, body, badge, photos = [], photoBg = '#ffffff', photoFit = 'cover', photoPos = 'center', flip = false, hide = false, quote, quoteAvatar, quoteName, quoteRole, dataType, perView = 1 }) {
const [page, setPage] = useStateProj(0);
const pages = Math.max(1, Math.ceil(photos.length / perView));
const hasSlider = pages > 1;
const go = (n) => setPage(((n % pages) + pages) % pages);
const visible = photos.slice(page * perView, page * perView + perView);
// pad visible to perView so the grid stays balanced
while (visible.length < perView && perView > 1) visible.push(null);
return (
1 ? ' is-grid' : ''}`} style={{ background: photoBg }} data-cols={perView > 1 ? Math.ceil(Math.sqrt(perView)) : 1}>
{perView === 1 ? (
photos.map((src, i) => (
/\.(mp4|webm)$/i.test(src) ? (
) : (

)
))
) : (
{visible.map((src, i) => (
{src &&

}
))}
)}
{hasSlider && (
<>
{Array.from({length: pages}).map((_, i) => (
go(i)}>
))}
>
)}
{badge &&
{badge}
}
{name} {italic && {italic}}
{type}
{body}
{quote && (
)}
);
}
/** Werkgever card — different layout: text left + image right (or lijst right) */
function WerkgeverCard({ name, italic, label, body, list = [], note, quote, quoteAttr, image, hide }) {
return (
{label}
{name} {italic && {italic}}
{body}
{quote && (
"{quote}"
{quoteAttr &&
{quoteAttr}
}
)}
{image ? (
) : (
Wat ik heb gedaan
{list.map((it, i) => - {it}
)}
{note && (
{note}
)}
)}
);
}
/** Filter bar for projects */
function PortfolioFilter({ active, onChange, options }) {
return (
{options.map((opt) => (
))}
);
}
/** Foto slideshow with horizontal carousel of slides */
function FotoSlideshow({ heading, italic, sub, slides = [] }) {
const [idx, setIdx] = useStateProj(0);
const perView = 3;
const max = Math.max(0, slides.length - perView);
const go = (n) => setIdx(Math.max(0, Math.min(max, n)));
return (
{heading} {italic && {italic}}
{sub &&
{sub}
}
{slides.map((src, i) => (
))}
{Array.from({length: max + 1}).map((_, i) => (
go(i)}>
))}
);
}
window.ProjectCard = ProjectCard;
window.WerkgeverCard = WerkgeverCard;
window.PortfolioFilter = PortfolioFilter;
window.FotoSlideshow = FotoSlideshow;