"use client"; import { useState } from "react"; import { IconChevron } from "./icons"; export function Gallery({ images, credit }: { images: string[]; credit: string }) { const [i, setI] = useState(0); const [bad, setBad] = useState>(new Set()); const imgs = images.filter((_, k) => !bad.has(k)); if (!imgs.length) return
Aucune photo disponible pour cette annonce
; const cur = Math.min(i, imgs.length - 1); return (
{/* eslint-disable-next-line @next/next/no-img-element */} {`Photo setBad((b) => new Set(b).add(images.indexOf(imgs[cur])))} /> {imgs.length > 1 && (<> {cur + 1} / {imgs.length} )}
Photos : {credit} (affichées depuis le site d'origine, droits réservés à leur propriétaire).
{imgs.length > 1 && (
{imgs.slice(0, 12).map((src, k) => ( // eslint-disable-next-line @next/next/no-img-element ))}
)}
); }