update
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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"
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user