Skip to content

Commit

Permalink
fix: base one screen size infinite props pass to Carousel component
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-nikunj committed Aug 29, 2024
1 parent 4a455a3 commit 37619e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/basic/ImageGallery/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className="cx-image-gallery">
{hovered && hoveredImage?.url && (
Expand All @@ -68,7 +74,7 @@ export const ImageGallery = ({
gapBetweenSlides={32}
gapCarouselTop={0}
dots={false}
infinite
infinite={getIsInfinite()}
itemHeight={maxHeight ?? 0}
itemWidth={maxWidth ?? 266}
slidesToShow={getSlidesToShow()}
Expand Down

0 comments on commit 37619e1

Please sign in to comment.