Selaa lähdekoodia

blank image on product detail

master
azri 1 kuukausi sitten
vanhempi
commit
9d417d4429
1 muutettua tiedostoa jossa 3 lisäystä ja 2 poistoa
  1. 3
    2
      src/components/ImageView/ImageView.jsx

+ 3
- 2
src/components/ImageView/ImageView.jsx Näytä tiedosto

@@ -8,6 +8,7 @@ import {
8 8
   DialogContent,
9 9
 } from "@mui/material";
10 10
 import Grid from '@mui/material/Grid2';
11
+import defaultImage from "../../assets/images/default.png"
11 12
 
12 13
 // Utility function to check if an object is empty
13 14
 const isEmptyObject = (obj) => Object.keys(obj).length === 0 && obj.constructor === Object;
@@ -48,7 +49,7 @@ const ImageView = () => {
48 49
             onClick={handleZoomToggle}
49 50
           >
50 51
             <Box
51
-              src={previewImage}
52
+              src={previewImage || defaultImage}
52 53
               component="img"
53 54
               alt="Preview"
54 55
               sx={{
@@ -110,7 +111,7 @@ const ImageView = () => {
110 111
       <Dialog open={isZoomed} onClose={handleZoomToggle} maxWidth="lg">
111 112
         <DialogContent>
112 113
           <img
113
-            src={previewImage}
114
+            src={previewImage || defaultImage}
114 115
             alt="Zoomed Preview"
115 116
             style={{
116 117
               width: "100%",

Loading…
Peruuta
Tallenna