diff --git a/package.json b/package.json index 7b99b05..a318bee 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "react-hook-form": "^7.56.1", "react-redux": "^9.2.0", "sonner": "^2.0.3", + "swiper": "^11.2.6", "tailwind-merge": "^3.2.0", "tailwindcss-animate": "^1.0.7", "tailwindcss-animated": "^2.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a4d7e28..cdecdd5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -110,6 +110,9 @@ importers: sonner: specifier: ^2.0.3 version: 2.0.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + swiper: + specifier: ^11.2.6 + version: 11.2.6 tailwind-merge: specifier: ^3.2.0 version: 3.2.0 @@ -2640,6 +2643,10 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + swiper@11.2.6: + resolution: {integrity: sha512-8aXpYKtjy3DjcbzZfz+/OX/GhcU5h+looA6PbAzHMZT6ESSycSp9nAjPCenczgJyslV+rUGse64LMGpWE3PX9Q==} + engines: {node: '>= 4.7.0'} + tailwind-merge@3.2.0: resolution: {integrity: sha512-FQT/OVqCD+7edmmJpsgCsY820RTD5AkBryuG5IUqR5YQZSdj5xlH5nLgH7YPths7WsLPSpSBNneJdM8aS8aeFA==} @@ -5314,6 +5321,8 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + swiper@11.2.6: {} + tailwind-merge@3.2.0: {} tailwindcss-animate@1.0.7(tailwindcss@4.1.4): diff --git a/src/widgets/partners-section.tsx b/src/widgets/partners-section.tsx index e85119f..a4dd682 100644 --- a/src/widgets/partners-section.tsx +++ b/src/widgets/partners-section.tsx @@ -1,14 +1,15 @@ 'use client'; import { Handshake } from 'lucide-react'; -import Image from 'next/image'; -import Link from 'next/link'; +import { useMemo } from 'react'; import { Partners } from '@/app/api-utlities/@types'; import { useTextController } from '@/shared/language/hooks/use-text-controller'; import { Button } from '@/shared/shadcn-ui/button'; +import { PartnersSlider } from './partners-slider'; + interface PartnersSectionProps { partners: Partners; } @@ -16,9 +17,19 @@ interface PartnersSectionProps { export const PartnersSection = ({ partners }: PartnersSectionProps) => { const { t } = useTextController(); + const [partnersFirstHalf, partnersSecondHalf] = useMemo(() => { + const length = partners.length; + const midPoint = Math.floor(length / 2); + + const partnersFirstHalf = partners.slice(0, midPoint); + const partnersSecondHalf = partners.slice(midPoint); + + return [partnersFirstHalf, partnersSecondHalf]; + }, [partners]); + return ( -
-
+
+
@@ -31,27 +42,17 @@ export const PartnersSection = ({ partners }: PartnersSectionProps) => {

-
- {partners.map(({ id, name, poster }) => ( -
- {`Partner -

{name}

-
- ))} -
+ + +

@@ -60,11 +61,9 @@ export const PartnersSection = ({ partners }: PartnersSectionProps) => {

{t('home.partners.becomePartnerText')}

- - - +

diff --git a/src/widgets/partners-slider.tsx b/src/widgets/partners-slider.tsx new file mode 100644 index 0000000..97e4191 --- /dev/null +++ b/src/widgets/partners-slider.tsx @@ -0,0 +1,75 @@ +'use client'; + +import Image from 'next/image'; +// Import Swiper styles +import 'swiper/css'; +import { Autoplay, FreeMode } from 'swiper/modules'; +import { Swiper, SwiperSlide } from 'swiper/react'; + +import { Partners } from '@/app/api-utlities/@types'; + +interface PartnersSliderProps { + partners: Partners; + autoplaySpeed?: number; + className?: string; + direction?: 'ltr' | 'rtl'; +} + +export function PartnersSlider({ + partners, + autoplaySpeed = 3000, + className = '', + direction = 'ltr', +}: PartnersSliderProps) { + return ( +
+ + {partners.map((partner) => ( + +
+ {partner.name} +
+
+ ))} +
+
+ ); +}