"use client"; import { useEffect, useState } from "react"; import { buttonClasses } from "@/components/ui/Button"; import type { AuftragFoto } from "@/lib/auftraege/fotos"; export function FotoGalerie({ fotos }: { fotos: AuftragFoto[] }) { const [offenerIndex, setOffenerIndex] = useState(null); useEffect(() => { if (offenerIndex === null) return; function onKeyDown(event: KeyboardEvent) { if (event.key === "Escape") setOffenerIndex(null); } window.addEventListener("keydown", onKeyDown); return () => window.removeEventListener("keydown", onKeyDown); }, [offenerIndex]); const offenesFoto = offenerIndex !== null ? fotos[offenerIndex] : null; return ( <>
{fotos.map((foto, index) => ( ))}
{offenesFoto && (
{offenesFoto.label}

{offenesFoto.label}

Download
)} ); }