From 37619e10ccbdda116c53722d6925ab17aab90911 Mon Sep 17 00:00:00 2001 From: Nikunj Maniya Date: Thu, 29 Aug 2024 11:11:16 +0530 Subject: [PATCH] fix: base one screen size infinite props pass to Carousel component --- src/components/basic/ImageGallery/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/basic/ImageGallery/index.tsx b/src/components/basic/ImageGallery/index.tsx index 6c190c16..59e94949 100644 --- a/src/components/basic/ImageGallery/index.tsx +++ b/src/components/basic/ImageGallery/index.tsx @@ -52,6 +52,12 @@ export const ImageGallery = ({ else return 3 } + const getIsInfinite = () => { + if (mobile) return gallery?.length > 1 + else if (tab) return gallery?.length > 2 + else return gallery?.length > 3 + } + return (
{hovered && hoveredImage?.url && ( @@ -68,7 +74,7 @@ export const ImageGallery = ({ gapBetweenSlides={32} gapCarouselTop={0} dots={false} - infinite + infinite={getIsInfinite()} itemHeight={maxHeight ?? 0} itemWidth={maxWidth ?? 266} slidesToShow={getSlidesToShow()}