refactor(images): replace raw img tags with next/image in SafeImage, VetGallery, and VideosPage [TASK-107]
This commit is contained in:
1 parent
01f4a7cf57
commit
0f32ec62c1
6 files changed
+34
-16
No files matched your search
@@ -1,9 +1,10 @@
|
||||
"use client";
|
||||
import React from "react";
|
||||
import Image from "next/image";
|
||||
import { ImageOff, Sparkles } from "lucide-react";
|
||||
import { cn } from "../lib/utils";
|
||||
|
||||
interface SafeImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
||||
interface SafeImageProps extends Omit<React.ImgHTMLAttributes<HTMLImageElement>, 'src'> {
|
||||
src?: string;
|
||||
alt?: string;
|
||||
className?: string;
|
||||
@@ -13,7 +14,7 @@ interface SafeImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {
|
||||
|
||||
export default function SafeImage({
|
||||
src,
|
||||
alt,
|
||||
alt = "تصویر مکمل کانینا",
|
||||
className,
|
||||
imgClassName,
|
||||
fallbackText = "در حال بروزرسانی تصویر...",
|
||||
@@ -56,9 +57,12 @@ export default function SafeImage({
|
||||
<Sparkles className="w-6 h-6 text-canina-blue/20" />
|
||||
</div>
|
||||
)}
|
||||
<img
|
||||
<Image
|
||||
src={src}
|
||||
alt={alt}
|
||||
width={500}
|
||||
height={500}
|
||||
unoptimized
|
||||
className={cn(
|
||||
"transition-all duration-700 w-full h-full",
|
||||
imgClassName,
|
||||
@@ -66,8 +70,6 @@ export default function SafeImage({
|
||||
)}
|
||||
onLoad={() => setLoading(false)}
|
||||
onError={() => setError(true)}
|
||||
referrerPolicy="no-referrer"
|
||||
{...props}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user