From 93d47fc8333f79573e9b8017631f01b0f72e91dc Mon Sep 17 00:00:00 2001 From: Samandar Turgunboyev Date: Wed, 17 Dec 2025 13:38:45 +0500 Subject: [PATCH] carousel prev and next button update --- src/widgets/welcome/ui/index.tsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/widgets/welcome/ui/index.tsx b/src/widgets/welcome/ui/index.tsx index aaebefc..b256130 100644 --- a/src/widgets/welcome/ui/index.tsx +++ b/src/widgets/welcome/ui/index.tsx @@ -26,17 +26,25 @@ const Welcome = () => { const [api, setApi] = useState(); const scrollPrev = () => { - api?.scrollPrev(); + if (api?.canScrollPrev()) { + api?.scrollPrev(); + } else if (!api?.canScrollPrev()) { + api?.scrollTo(api?.slideNodes().length - 1); + } }; const scrollNext = () => { - api?.scrollNext(); + if (api?.canScrollNext()) { + api?.scrollNext(); + } else if (!api?.canScrollNext()) { + api?.scrollTo(0); + } }; return (
- + {banner.map((e, index) => ( @@ -52,7 +60,7 @@ const Welcome = () => {