From 8c0d3e7b8e2796a2ea8f5f89d1c7eae0324fa11c Mon Sep 17 00:00:00 2001 From: nickbristow Date: Fri, 25 Oct 2024 15:13:25 -0400 Subject: [PATCH] adjustments --- src/app/components/Carousel.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/components/Carousel.tsx b/src/app/components/Carousel.tsx index fcf4239..d1e91db 100644 --- a/src/app/components/Carousel.tsx +++ b/src/app/components/Carousel.tsx @@ -68,13 +68,17 @@ export default function MultiImageCarousel() { }; const prevSlide = () => { - setCurrentIndex( - currentIndex === 0 ? images.length - itemsPerView : currentIndex - 1, - ); + setCurrentIndex(currentIndex === 0 ? 0 : currentIndex - 1); }; const nextSlide = () => { - setCurrentIndex((currentIndex + 1) % (images.length - itemsPerView + 1)); + const newIndex = currentIndex + 1; + setCurrentIndex( + newIndex > images.length - itemsPerView + 2 + ? images.length - itemsPerView + 2 + : newIndex, + ); + // setCurrentIndex((currentIndex + 1) % (images.length - itemsPerView + 1)); }; return (