From 37901420600e5b1f083c61510f158759799620c0 Mon Sep 17 00:00:00 2001 From: Wagner Trezub Date: Wed, 23 Oct 2024 13:01:29 +0200 Subject: [PATCH] fix: set the nSlidesToShow prop correctly --- src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx b/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx index 33ed4a40d..d3fbc1d6b 100644 --- a/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx +++ b/src/components/ItaliaTheme/Blocks/Listing/SliderTemplate.jsx @@ -210,7 +210,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 = () => {