'use client' import { useState, useEffect, useCallback } from 'react' import { motion, AnimatePresence } from 'framer-motion' import { ChevronLeft, ChevronRight } from 'lucide-react' import type { MediaItem } from '@/lib/types' export default function PhotoSlideshow({ photos }: { photos: MediaItem[] }) { const [current, setCurrent] = useState(0) const [paused, setPaused] = useState(false) const next = useCallback( () => setCurrent((c) => (c + 1) % photos.length), [photos.length] ) const prev = useCallback( () => setCurrent((c) => (c - 1 + photos.length) % photos.length), [photos.length] ) useEffect(() => { if (paused || photos.length <= 1) return const id = setInterval(next, 5500) return () => clearInterval(id) }, [paused, photos.length, next]) if (photos.length === 0) return null return (
setPaused(true)} onMouseLeave={() => setPaused(false)} > {photos[current].caption
{photos[current].caption && (

{photos[current].caption}

)} {/* Navigation arrows */} {photos.length > 1 && ( <> )} {/* Dots */} {photos.length > 1 && (
{photos.map((_, i) => (
)}
) }