From d6ccc6bc33c13d792aa99e57eb6b137eac142e43 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Wed, 11 Feb 2026 18:01:02 +0700 Subject: (andri) fix slider banner promo --- src-migrate/modules/promo/components/Hero.tsx | 35 +++++++++++++++------------ 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src-migrate/modules/promo/components/Hero.tsx b/src-migrate/modules/promo/components/Hero.tsx index e1b31184..1004932b 100644 --- a/src-migrate/modules/promo/components/Hero.tsx +++ b/src-migrate/modules/promo/components/Hero.tsx @@ -39,7 +39,7 @@ const swiperBannerMob = { }, modules: [Pagination, Autoplay], loop: true, - className: 'mobile-swiper w-full', + className: 'mobile-swiper w-full', slidesPerView: 1, }; @@ -54,10 +54,24 @@ const Hero = () => { [heroBanner.data] ); - const swiperBannerMobile = { + const isSingleSlide = banners.length <= 1; + + const swiperSettingsDesktop = useMemo(() => ({ + ...swiperBanner, + loop: !isSingleSlide, + allowTouchMove: !isSingleSlide, + autoplay: isSingleSlide ? false : swiperBanner.autoplay, + pagination: isSingleSlide ? false : swiperBanner.pagination, + }), [isSingleSlide]); + + + const swiperSettingsMobile = useMemo(() => ({ ...swiperBannerMob, - pagination: { dynamicBullets: false, clickable: true }, - }; + loop: !isSingleSlide, + allowTouchMove: !isSingleSlide, + autoplay: isSingleSlide ? false : swiperBannerMob.autoplay, + pagination: isSingleSlide ? false : { dynamicBullets: false, clickable: true }, + }), [isSingleSlide]); return ( <> @@ -77,18 +91,9 @@ const Hero = () => { `}
- + {banners?.map((banner, index) => ( - - {/* -
-
- ... -
-
- */} -
{
- + {banners?.map((banner, index) => (
-- cgit v1.2.3