2025-10-12 17:42:17 +00:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
|
import Image from "next/image";
|
|
|
|
|
import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
|
|
|
|
|
|
|
import { Autoplay, Pagination } from "swiper/modules";
|
|
|
|
|
import { PartnersType } from "@/lib/types/PartnersData.type";
|
|
|
|
|
import { baseAPI } from "@/lib/API";
|
2026-02-11 20:45:37 +00:00
|
|
|
import { useTranslations, useLocale } from "next-intl";
|
2025-10-12 17:42:17 +00:00
|
|
|
import { Title } from "../ui/title";
|
|
|
|
|
|
|
|
|
|
export const Partners = () => {
|
2026-02-11 20:45:37 +00:00
|
|
|
const locale = useLocale();
|
|
|
|
|
const t = useTranslations("home");
|
2025-10-12 17:42:17 +00:00
|
|
|
const [partnersData, setPartnersData] = useState<PartnersType>();
|
|
|
|
|
|
|
|
|
|
const fetchPartners = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const res = await fetch(`${baseAPI}partners`, {
|
|
|
|
|
headers: {
|
2026-02-11 20:45:37 +00:00
|
|
|
"Accept-Language": locale,
|
2025-10-12 17:42:17 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const data = await res.json();
|
|
|
|
|
|
|
|
|
|
setPartnersData(data);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(error);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchPartners();
|
2026-02-11 20:45:37 +00:00
|
|
|
}, [locale]);
|
2025-10-12 17:42:17 +00:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<section className="container">
|
|
|
|
|
<div className="mb-[40px]">
|
2026-02-11 20:45:37 +00:00
|
|
|
<Title text={t("partners")} />
|
2025-10-12 17:42:17 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
<Swiper
|
|
|
|
|
modules={[Pagination, Autoplay]}
|
|
|
|
|
loop
|
|
|
|
|
slidesPerView={5}
|
|
|
|
|
autoplay={{ delay: 0 }}
|
|
|
|
|
spaceBetween={30}
|
|
|
|
|
speed={7000}
|
|
|
|
|
breakpoints={{
|
|
|
|
|
1024: { slidesPerView: 5 },
|
|
|
|
|
768: { slidesPerView: 4.5 },
|
|
|
|
|
630: { slidesPerView: 3.5 },
|
|
|
|
|
300: { slidesPerView: 2 },
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{partnersData &&
|
|
|
|
|
partnersData.data.map((logo, i) => (
|
|
|
|
|
<SwiperSlide key={i} className="h-[63px] w-fit overflow-hidden">
|
|
|
|
|
<a href={logo.link} target="_blank">
|
|
|
|
|
<Image
|
|
|
|
|
height={200}
|
|
|
|
|
width={200}
|
|
|
|
|
src={logo.images[0].path}
|
|
|
|
|
alt="logo"
|
|
|
|
|
className="h-full w-full object-contain"
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
</SwiperSlide>
|
|
|
|
|
))}
|
|
|
|
|
</Swiper>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
};
|