Browse Source

blank image on product detail

master
azri 1 month ago
parent
commit
9d417d4429
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      src/components/ImageView/ImageView.jsx

+ 3
- 2
src/components/ImageView/ImageView.jsx View File

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

Loading…
Cancel
Save