ldc-bien-etre-animal/resources/ts/front/Components/Shared/ImageCard.tsx
2026-08-28 10:40:04 +02:00

37 lines
1.1 KiB
TypeScript

import useDeviceType from "@/hooks/use-device-type";
interface ImageCardProps {
image: string;
imageWebp?: string;
isActive?: boolean;
rotation?: number;
compactRotation?: number;
}
export default function ImageCard({
image,
imageWebp,
isActive = false,
rotation = 0,
compactRotation = 0,
}: Readonly<ImageCardProps>) {
const { isMobile, isTablet } = useDeviceType();
const isCompact = isMobile || isTablet;
const effectiveRotation = isCompact ? compactRotation : rotation;
return (
<div
className={`shrink-0 overflow-hidden rounded-[20px] bg-white shadow-[0px_4px_15px_rgba(0,0,0,0.15)] transition-all duration-300 ${
isActive
? "h-[180px] w-[150px] scale-105 lg:h-[450px] lg:w-[350px]"
: "h-[160px] w-[130px] scale-95 lg:h-[450px] lg:w-[350px]"
}`}
style={{ transform: `rotate(${String(effectiveRotation)}deg)` }}
>
<picture>
{imageWebp && <source srcSet={imageWebp} type="image/webp" />}
<img src={image} alt="" className="h-full w-full object-contain" />
</picture>
</div>
);
}