From 8d01051b5b8f5e8a9295f1993c45755fc176aacc Mon Sep 17 00:00:00 2001 From: David Luis <95457148+babiabeo@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:31:06 +0700 Subject: [PATCH] docs: fix carousel not working properly (#2222) Currently, the [Carousel component](https://fresh.deno.dev/components) only shows "slide four" without moving to other slides. This PR will fix that issue. --- www/components/gallery/Carousel.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/www/components/gallery/Carousel.tsx b/www/components/gallery/Carousel.tsx index 4d271db3..f55ef458 100644 --- a/www/components/gallery/Carousel.tsx +++ b/www/components/gallery/Carousel.tsx @@ -75,14 +75,13 @@ const Carousel = (props: CarouselProps) => { let incomingSlide = currentSlide.value + 1; if (outgoingSlide === -1) outgoingSlide = SLIDE_DATA.length - 1; if (incomingSlide === SLIDE_DATA.length) incomingSlide = 0; - // console.log(outgoingSlide, currentSlide.value, incomingSlide) const TRANSITION_CLASS = () => { if (currentSlide.value === idx) return "translate-x-0 z-20"; if (incomingSlide === idx) return "translate-x-full z-10"; if (outgoingSlide === idx) return "-translate-x-full z-10"; return "translate-x-full"; }; - return `slide absolute top-0 left-0 transition-all ease-in-out duration-700 transform ${TRANSITION_CLASS}`; + return `slide absolute top-0 left-0 transition-all ease-in-out duration-700 transform ${TRANSITION_CLASS()}`; }; const nextSlide = () => {