From cc106cf0e6e3f0e05380c6abb81c6bf16dc539b8 Mon Sep 17 00:00:00 2001 From: Wagner Trezub <60133113+Wagner3UB@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:27:35 +0200 Subject: [PATCH] fix: set the nSlidesToShow prop correctly (#792) --- 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 = () => {