turkmen-expo/components/shared/Reviews.tsx

85 lines
3.0 KiB
TypeScript
Raw Normal View History

2025-12-03 09:32:15 +00:00
"use client";
import { Swiper, SwiperSlide } from "swiper/react";
import { Autoplay, Pagination } from "swiper/modules";
import "swiper/css";
import "swiper/css/pagination";
import { useFetch } from "@/hooks/useFetch";
import { ReviewsType } from "@/lib/types/Reviews.type";
import { useTranslations } from "next-intl";
2025-12-03 09:32:15 +00:00
import { Title } from "../ui/title";
2025-12-04 09:18:17 +00:00
import Image from "next/image";
2025-12-03 09:32:15 +00:00
export const Reviews = () => {
const { data } = useFetch<ReviewsType>("reviews");
const t = useTranslations("home");
2025-12-03 09:32:15 +00:00
return (
2025-12-04 09:18:17 +00:00
<section className="container my-20 pb-20 overflow-hidden">
<Title text={t("feedback")} className="!text-center mb-10" />
2025-12-03 09:32:15 +00:00
2025-12-04 09:18:17 +00:00
<div className="max-w-[1200px] mx-auto px-4 md:px-0">
2025-12-03 09:32:15 +00:00
<Swiper
modules={[Autoplay, Pagination]}
2025-12-04 09:18:17 +00:00
style={{ overflow: "visible" }}
freeMode
2025-12-03 09:32:15 +00:00
speed={1000}
pagination={{
clickable: true,
el: ".custom-pagination",
bulletClass:
"dot transition-all duration-300 bg-gray-300 rounded-full w-3 h-3 mx-1",
bulletActiveClass: "dot-active !bg-PRIMARY scale-125",
}}
2025-12-04 09:18:17 +00:00
spaceBetween={24}
slidesPerView={3}
slidesPerGroup={3}
breakpoints={{
0: { slidesPerView: 1, slidesPerGroup: 1, spaceBetween: 16 },
768: { slidesPerView: 2, slidesPerGroup: 2, spaceBetween: 20 },
1024: { slidesPerView: 3, slidesPerGroup: 3, spaceBetween: 24 },
}}
2025-12-03 09:32:15 +00:00
className="testimonials-swiper"
>
{data?.data?.map((item, i) => (
2025-12-04 09:18:17 +00:00
<SwiperSlide
key={item?.id ?? i}
className="flex-[0_0_auto] min-h-[300px] pb-10 h-full flex items-stretch relative"
>
<article className="bg-white p-10 size-full rounded-[38px] flex flex-col gap-5 h-full flex-1">
<Image
src="/assets/icons/quotes.svg"
alt=""
height={35}
width={35}
/>
2025-12-03 09:32:15 +00:00
2025-12-04 09:18:17 +00:00
<p className="text-sm text-[#171C1B]">{item?.text}</p>
2025-12-03 09:32:15 +00:00
2025-12-04 09:18:22 +00:00
<div className="flex flex-col gap-5 items-center absolute left-1/2 -translate-x-1/2 top-[82%]">
2025-12-04 09:18:17 +00:00
<div className="flex justify-center items-center overflow-hidden rounded-full border-4 border-PRIMARY size-[70px]">
<Image
src={item?.image?.path ?? ""}
alt={item?.name}
height={50}
width={50}
className="obejct-contain"
2025-12-03 09:32:15 +00:00
/>
2025-12-04 09:18:17 +00:00
</div>
<div className="text-center flex flex-col gap-1.5">
<h3 className="text-base font-bold">{item?.name}</h3>
<p className="text-sm">{item?.job_title}</p>
</div>
2025-12-03 09:32:15 +00:00
</div>
</article>
</SwiperSlide>
))}
</Swiper>
2025-12-04 09:18:22 +00:00
<div className="custom-pagination flex justify-center items-center mt-60"></div>
2025-12-03 09:32:15 +00:00
</div>
</section>
);
};