ldc-bien-etre-animal/resources/ts/front/Components/Approaches/ApproachCarousel.tsx

61 lines
1.7 KiB
TypeScript

import CarouselContent from "@/front/Components/Shared/Carousel/CarouselContent";
import SliderCustomCard from "@/front/Components/Shared/SliderCustomCard";
import { cardType, type CardTypeName } from "@/front/lib/constants";
import useDeviceType from "@/hooks/use-device-type";
interface Approach {
number: string;
title: string;
rotation?: number;
compactRotation?: number;
verso?: string;
ctaHref?: string;
ctaLabel?: string;
}
interface ApproachProps {
approaches: Approach[];
controlsDotColor?: string;
controlsColor?: string;
type?: CardTypeName;
}
export default function ApproachesCarousel({
approaches,
controlsDotColor = "bg-bleu",
controlsColor = "text-bleu border-bleu hover:bg-bleu/10",
type = cardType.FLIP,
}: Readonly<ApproachProps>) {
const { isMobile } = useDeviceType();
return (
<div className="px-0 sm:px-4 md:px-8">
<CarouselContent
carouselClass="!overflow-visible"
draggable={true}
carousel={{
pagination: false,
centeredSlides: isMobile,
spaceBetween: isMobile ? 24 : 50,
}}
controlsDotColor={controlsDotColor}
controlsColor={controlsColor}
items={approaches}
renderItem={(approach, index, isActive) => (
<SliderCustomCard
key={index}
number={approach.number}
title={approach.title}
verso={approach.verso}
rotation={approach.rotation}
compactRotation={approach.compactRotation}
isActive={isActive}
type={type}
ctaHref={approach.ctaHref}
ctaLabel={approach.ctaLabel}
/>
)}
showStar={false}
/>
</div>
);
}