'use client'; import { ArrowLeftIcon, ArrowRightIcon } from '@heroicons/react/24/outline'; import clsx from 'clsx'; 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 [currentImage, setCurrentImage] = useState(0); function handleNavigate(direction: 'next' | 'previous') { if (direction === 'next') { setCurrentImage(currentImage + 1 < images.length ? currentImage + 1 : 0); } else { setCurrentImage(currentImage === 0 ? images.length - 1 : currentImage - 1); } } const buttonClassName = 'h-full px-6 transition-all ease-in-out hover:scale-110 hover:text-black dark:hover:text-white'; return (
{images[currentImage] && ( {images[currentImage]?.altText )} {images.length > 1 ? (
) : null}
{images.length > 1 ? (
{images.map((image, index) => { const isActive = index === currentImage; return ( ); })}
) : null}
); }