'use client' import { PauseCircle, PlayCircle } from 'lucide-react' import Image from 'next/image' import { useEffect, useState } from 'react' import { cn } from 'ui' interface ImageFadeStackProps { autoplay?: boolean images: string[] height?: 'default' delay?: number altText?: string showNavigation?: boolean } const ImageFadeStack = ({ images, height = 'default', delay = 3000, autoplay = false, altText = 'Image', showNavigation = false, }: ImageFadeStackProps) => { const [currentImageIndex, setCurrentImageIndex] = useState(0) const [isPlaying, setIsPlaying] = useState(autoplay) useEffect(() => { if (isPlaying) { const intervalId = setInterval(() => { setCurrentImageIndex((prevIndex) => (prevIndex + 1) % images.length) }, delay) return () => clearInterval(intervalId) } }, [images, isPlaying]) function handleNavClick(index: number) { setIsPlaying(false) setCurrentImageIndex(index) } return (
{images.map((image, index) => ( <> {altText} ))}
{showNavigation && images.map((_, index) => ( ))}
) } export default ImageFadeStack