'use client'; import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline'; import { GridTileImage } from 'components/grid/tile'; import Image from 'next/image'; import { useState } from 'react'; export function Gallery({ images }: { images: { src: string; altText: string }[] }) { const [currentImageIndex, setCurrentImageIndex] = useState(0); function handleNavigate(direction: 'next' | 'previous') { if (direction === 'next') { setCurrentImageIndex(currentImageIndex + 1 < images.length ? currentImageIndex + 1 : 0); } else { setCurrentImageIndex(currentImageIndex === 0 ? images.length - 1 : currentImageIndex - 1); } } const buttonClassName = 'h-full px-6 transition-all ease-in-out hover:scale-110 hover:text-black dark:hover:text-white'; return (
{images[currentImageIndex] && ( {images[currentImageIndex]?.altText )} {images.length > 1 ? (
) : null}
{images.length > 1 ? (
{images.map((image, index) => { const isActive = index === currentImageIndex; return ( ); })}
) : null}
); }