소스 검색

add image close button and scroll image list

master
azri 3 주 전
부모
커밋
6d8a9b4dbb
2개의 변경된 파일26개의 추가작업 그리고 10개의 파일을 삭제
  1. 25
    9
      src/components/ImageView/ImageView.jsx
  2. 1
    1
      src/services/ProductService.js

+ 25
- 9
src/components/ImageView/ImageView.jsx 파일 보기

@@ -8,6 +8,7 @@ import {
8 8
   DialogContent,
9 9
 } from "@mui/material";
10 10
 import Grid from '@mui/material/Grid2';
11
+import CloseIcon from "@mui/icons-material/Close";
11 12
 import defaultImage from "../../assets/images/default.png"
12 13
 
13 14
 // Utility function to check if an object is empty
@@ -53,10 +54,10 @@ const ImageView = () => {
53 54
               component="img"
54 55
               alt="Preview"
55 56
               sx={{
56
-                width:{
57
-                  xs:"100%",
58
-                  sm:"100%",
59
-                  md:"70%"
57
+                width: {
58
+                  xs: "100%",
59
+                  sm: "100%",
60
+                  md: "70%"
60 61
                 },
61 62
                 height: "auto",
62 63
                 display: "block",
@@ -73,11 +74,12 @@ const ImageView = () => {
73 74
               display: "flex",
74 75
               flexDirection: "row",
75 76
               justifyContent: {
76
-                xs:"left",
77
-                sm:"left",
78
-                md:"center"
77
+                xs: "left",
78
+                sm: "left",
79
+                md: "center"
79 80
               },
80
-              flexWrap:"wrap",
81
+              overflowX: "scroll",
82
+              overflowY: "none",
81 83
               padding: 2,
82 84
               gap: 2
83 85
             }}
@@ -109,7 +111,7 @@ const ImageView = () => {
109 111
 
110 112
       {/* Zoom Dialog */}
111 113
       <Dialog open={isZoomed} onClose={handleZoomToggle} maxWidth="lg">
112
-        <DialogContent>
114
+        <DialogContent sx={{ position: "relative" }}>
113 115
           <img
114 116
             src={previewImage || defaultImage}
115 117
             alt="Zoomed Preview"
@@ -118,6 +120,20 @@ const ImageView = () => {
118 120
               height: "auto",
119 121
             }}
120 122
           />
123
+          <Box sx={{ width: 50, height: 50, position: "absolute", top: 10, right: 10 }}>
124
+            <IconButton
125
+              onClick={handleZoomToggle}
126
+              sx={{
127
+                backgroundColor: "white",
128
+                color: "black",
129
+                "&:hover": {
130
+                  backgroundColor: "lightgray",
131
+                },
132
+              }}
133
+            >
134
+              <CloseIcon />
135
+            </IconButton>
136
+          </Box>
121 137
         </DialogContent>
122 138
       </Dialog>
123 139
     </Box>

+ 1
- 1
src/services/ProductService.js 파일 보기

@@ -127,7 +127,7 @@ const getProduct = async (handle = "") => {
127 127
           currencyCode
128 128
         }
129 129
       }
130
-      images(first: 4) {
130
+      images(first: 250) {
131 131
         nodes {
132 132
           url
133 133
         }

Loading…
취소
저장