Skip to content

Commit

Permalink
fix: avoid items repeat if nSlides is lower than results lenght
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliaghisini committed Feb 5, 2024
1 parent 2d6ff0a commit ddd5009
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ const SliderTemplate = ({
}) => {
const intl = useIntl();
const [userAutoplay, setUserAutoplay] = useState(autoplay);
const nSlidesToShow = parseInt(slidesToShow);
const nSlidesToShow =
items.length < parseInt(slidesToShow)
? items.length
: parseInt(slidesToShow);
const Slider = reactSlick.default;
const { slider, focusNext } = useSlider(userAutoplay);
const toggleAutoplay = () => {
Expand Down
4 changes: 4 additions & 0 deletions src/theme/ItaliaTheme/Blocks/_sliderTemplate.scss
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@
> .card-wrapper {
height: 100%;
}

> .card {
margin: 0.5rem 0;
}
}
}
}
Expand Down

0 comments on commit ddd5009

Please sign in to comment.