ldc-bien-etre-animal/resources/ts/front/Components/Stats/StatCard.tsx
2026-09-04 19:40:48 +02:00

51 lines
1.4 KiB
TypeScript

import useDeviceType from "@/hooks/use-device-type";
interface StatCardProps {
number: string;
subtitle: string;
description: string;
isActive?: boolean;
rotation?: number;
}
export default function StatCard({
number,
subtitle,
description,
isActive = false,
rotation = 2,
}: Readonly<StatCardProps>) {
const { isMobile, isTablet } = useDeviceType();
const isCompact = isMobile || isTablet;
const effectiveRotation = isCompact ? 2 : rotation;
return (
<div
className={`mx-auto flex w-[92%] shrink-0 flex-col gap-4 rounded-[32px] bg-white p-6 shadow-[0px_4px_15px_rgba(49,39,131,0.3)] transition-all duration-300 md:w-[90%] ${
isActive
? "shadow-[0px_8px_25px_rgba(49,39,131,0.5)] lg:w-[370px]"
: "lg:w-[370px]"
}`}
style={{
transform: `rotate(${String(effectiveRotation)}deg) scale(${String(isActive ? 1.05 : 0.95)})`,
}}
>
<p
className={`font-lato-black leading-none text-bleu ${
isMobile ? "" : isActive ? "text-[96px]" : "text-[64px]"
}`}
style={isCompact ? { fontSize: "96px" } : undefined}
>
{number}
</p>
<p className="font-lato-bold text-[36px] leading-tight text-bleu">
{subtitle}
</p>
<p className="font-poppins-regular text-small text-bleu/70">
{description}
</p>
</div>
);
}