Skip to content

Commit

Permalink
Merge pull request #2441 from WTTJ/fix-full-width-swiper
Browse files Browse the repository at this point in the history
fix: computation of slides per view when swiper is full width
  • Loading branch information
simon-hv authored May 3, 2024
2 parents 6251a06 + 9a24a71 commit efc6c2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/Swiper/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ export const useSwiper = (options: UseSwiperProps = {}) => {
return slidesPerView.mobile
} else if (viewportWidth <= screens.lg) {
return slidesPerView.tablet
} else if (viewportWidth >= screens['4xl'] && fullWidth) {
return slidesPerView.desktop + 2
} else {
return slidesPerView.desktop
}
}, [slidesPerView, screens.md, screens.lg, viewportWidth])
}, [fullWidth, viewportWidth, screens, slidesPerView])

return {
centeredSlides,
Expand Down
2 changes: 1 addition & 1 deletion packages/Swiper/src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export const Container = styled.ul<Pick<UseSwiper, 'slidesPerView' | 'spaceBetwe
`}
}
@media (min-width: 1920px) {
@media (min-width: 4xl) {
${desktop &&
fullWidth &&
css`
Expand Down

0 comments on commit efc6c2c

Please sign in to comment.