Files
gaufrementbon/src/components/site/WaffleMenuImage.tsx
T
gpatruno e45e9f154e update
2026-06-11 17:30:13 +02:00

34 lines
730 B
TypeScript

import Image from "next/image";
import { isUploadAssetPath } from "@/lib/image-url";
type Props = {
src: string;
alt: string;
};
export function WaffleMenuImage({ src, alt }: Props) {
if (src.startsWith("http://") || src.startsWith("https://")) {
return (
// eslint-disable-next-line @next/next/no-img-element -- URLs externes arbitraires
<img
src={src}
alt={alt}
className="h-full w-full object-cover"
loading="lazy"
referrerPolicy="no-referrer"
/>
);
}
return (
<Image
src={src}
alt={alt}
fill
unoptimized={isUploadAssetPath(src)}
className="object-cover"
sizes="(max-width: 640px) 100vw, 50vw"
/>
);
}