|
@@ -1,13 +1,68 @@
|
1
|
1
|
import React from "react";
|
2
|
|
-import { Drawer, Box, List, ListItem, ListItemButton, ListItemText } from "@mui/material";
|
|
2
|
+import { Drawer, Box, List, ListItem, ListItemButton, ListItemText, Accordion, AccordionSummary, AccordionDetails, AccordionActions, Typography, Button } from "@mui/material";
|
|
3
|
+import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
4
|
+import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
5
|
+import Grid from '@mui/material/Grid2';
|
3
|
6
|
import logoSrc from "../../../../assets/images/amberlogo.png";
|
4
|
7
|
|
5
|
8
|
const MobileNav = ({ open, onClose, menu = [] }) => {
|
|
9
|
+
|
|
10
|
+ // React.useEffect(()=>{
|
|
11
|
+
|
|
12
|
+ // console.log(menu)
|
|
13
|
+ // debugger
|
|
14
|
+
|
|
15
|
+ // },[menu])
|
|
16
|
+
|
|
17
|
+ const renderCollectionDisplay = (colletion) => {
|
|
18
|
+
|
|
19
|
+ return (
|
|
20
|
+ <Grid
|
|
21
|
+ size={6}
|
|
22
|
+ className="animate__animated animate__fadeIn animate__fast"
|
|
23
|
+ sx={{
|
|
24
|
+ padding:5,
|
|
25
|
+ backgroundImage: `url(${colletion?.image?.url})`,
|
|
26
|
+ backgroundSize: "cover",
|
|
27
|
+ backgroundRepeat: "no-repeat",
|
|
28
|
+ backgroundPosition: "center center",
|
|
29
|
+ height: "100%",
|
|
30
|
+ paddingTop: "45%",
|
|
31
|
+ position: "relative",
|
|
32
|
+ cursor: "pointer",
|
|
33
|
+ transition: "transform 0.3s ease",
|
|
34
|
+ ":hover": {
|
|
35
|
+ transform: "scale(1.1)"
|
|
36
|
+ }
|
|
37
|
+ }}
|
|
38
|
+ onClick={() => {
|
|
39
|
+ // sessionStorage.setItem('amber-select-collection', colletion?.title)
|
|
40
|
+ // sessionStorage.setItem('amber-select-product-type', displayCollection.productType)
|
|
41
|
+ window.location.href = `/products`;
|
|
42
|
+ }}
|
|
43
|
+ >
|
|
44
|
+ <Typography
|
|
45
|
+ variant="body1"
|
|
46
|
+ sx={{
|
|
47
|
+ color: "white",
|
|
48
|
+ fontWeight: "bolder",
|
|
49
|
+ position: "absolute",
|
|
50
|
+ top: "50%",
|
|
51
|
+ left: "50%",
|
|
52
|
+ transform: "translate(-50%, -50%)"
|
|
53
|
+ }}
|
|
54
|
+ >
|
|
55
|
+ {colletion?.title?.toUpperCase()}
|
|
56
|
+ </Typography>
|
|
57
|
+ </Grid>
|
|
58
|
+ )
|
|
59
|
+
|
|
60
|
+ }
|
|
61
|
+
|
6
|
62
|
return (
|
7
|
63
|
<Drawer
|
8
|
64
|
open={open}
|
9
|
65
|
onClose={onClose}
|
10
|
|
- onClick={()=>{onClose()}}
|
11
|
66
|
sx={{
|
12
|
67
|
"& .MuiDrawer-paper": {
|
13
|
68
|
backgroundColor: "white",
|
|
@@ -17,47 +72,106 @@ const MobileNav = ({ open, onClose, menu = [] }) => {
|
17
|
72
|
}}
|
18
|
73
|
>
|
19
|
74
|
{/* Logo Section */}
|
20
|
|
- <Box
|
21
|
|
- sx={{
|
22
|
|
- display: "flex",
|
23
|
|
- justifyContent: "center",
|
24
|
|
- alignItems: "center",
|
25
|
|
- height: 80,
|
26
|
|
- }}
|
27
|
|
- >
|
28
|
|
- <a href="/">
|
29
|
|
- <img
|
30
|
|
- src={logoSrc}
|
31
|
|
- alt="Logo"
|
32
|
|
- style={{
|
33
|
|
- width: 150,
|
34
|
|
- height: 25,
|
35
|
|
- }}
|
36
|
|
- />
|
37
|
|
- </a>
|
|
75
|
+ <Box sx={{ height: 80, px: 2 }}>
|
|
76
|
+ <Grid
|
|
77
|
+ container
|
|
78
|
+ alignItems="center"
|
|
79
|
+ justifyContent="space-between"
|
|
80
|
+ sx={{ height: "100%" }}
|
|
81
|
+ >
|
|
82
|
+ {/* Left Spacer */}
|
|
83
|
+ <Grid item xs={3} />
|
|
84
|
+
|
|
85
|
+ {/* Centered Logo */}
|
|
86
|
+ <Grid item xs={6} container justifyContent="center">
|
|
87
|
+ <a href="/">
|
|
88
|
+ <img
|
|
89
|
+ src={logoSrc}
|
|
90
|
+ alt="Logo"
|
|
91
|
+ style={{
|
|
92
|
+ width: 150,
|
|
93
|
+ height: 25,
|
|
94
|
+ }}
|
|
95
|
+ />
|
|
96
|
+ </a>
|
|
97
|
+ </Grid>
|
38
|
98
|
|
|
99
|
+ {/* Right 'X' Button */}
|
|
100
|
+ <Grid item xs={3} container justifyContent="flex-end">
|
|
101
|
+ <button
|
|
102
|
+ onClick={() => { onClose() }}
|
|
103
|
+ style={{
|
|
104
|
+ background: "none",
|
|
105
|
+ border: "none",
|
|
106
|
+ fontSize: 24,
|
|
107
|
+ cursor: "pointer",
|
|
108
|
+ }}
|
|
109
|
+ >
|
|
110
|
+ ✕ {/* Unicode for "X" symbol */}
|
|
111
|
+ </button>
|
|
112
|
+ </Grid>
|
|
113
|
+ </Grid>
|
39
|
114
|
</Box>
|
40
|
115
|
|
|
116
|
+
|
41
|
117
|
{/* Main Navigation */}
|
42
|
|
- <Box sx={{ width: 250 }} role="presentation">
|
43
|
|
- <List>
|
44
|
|
- {menu.map(({ title, link }) => (
|
45
|
|
- <ListItem key={title} disablePadding>
|
|
118
|
+ <Box sx={{ width: "100%" }} role="presentation">
|
|
119
|
+ {/* <List>
|
|
120
|
+ {menu.map(({ productType, collection }) => (
|
|
121
|
+ <ListItem key={productType} disablePadding>
|
46
|
122
|
<ListItemButton
|
47
|
|
- onClick={() => { window.location.href = link }}
|
|
123
|
+ onClick={() => {
|
|
124
|
+ sessionStorage.setItem('amber-select-collection', productType)
|
|
125
|
+ sessionStorage.removeItem('amber-select-collection')
|
|
126
|
+ if(collection?.length == 0) window.location.href = `/products`;
|
|
127
|
+ }}
|
48
|
128
|
sx={{
|
49
|
|
- color: "white",
|
|
129
|
+ borderTop:"1px solid rgba(0,0,0,0.1)",
|
50
|
130
|
"&:hover": {
|
51
|
|
- backgroundColor: "white",
|
52
|
|
- color: "black",
|
|
131
|
+ backgroundColor: "#95AAC5",
|
53
|
132
|
},
|
54
|
133
|
}}
|
55
|
134
|
>
|
56
|
|
- <ListItemText sx={{ ml: 2 }} primary={title} />
|
|
135
|
+ <ListItemText sx={{
|
|
136
|
+ ml: 2,
|
|
137
|
+ color: "black",
|
|
138
|
+ }} primary={productType?.toUpperCase()} />
|
|
139
|
+ {(collection?.length > 0) && <ArrowDropDownIcon fontSize="small" sx={{color:"black"}} /> }
|
57
|
140
|
</ListItemButton>
|
58
|
141
|
</ListItem>
|
59
|
142
|
))}
|
60
|
|
- </List>
|
|
143
|
+ </List> */}
|
|
144
|
+ {menu.map(({ productType, collection }) => (
|
|
145
|
+ <Accordion
|
|
146
|
+ disableGutters={true}
|
|
147
|
+ onClick={() => {
|
|
148
|
+ sessionStorage.setItem('amber-select-collection', productType)
|
|
149
|
+ sessionStorage.removeItem('amber-select-collection')
|
|
150
|
+ if (collection?.length == 0) window.location.href = `/products`;
|
|
151
|
+ }}
|
|
152
|
+ sx={{
|
|
153
|
+ backgroundColor: "rgba(0,0,0,0)",
|
|
154
|
+ boxShadow: "none"
|
|
155
|
+ }}>
|
|
156
|
+ <AccordionSummary
|
|
157
|
+ expandIcon={(collection?.length > 0) ? <ExpandMoreIcon /> : ""}
|
|
158
|
+ aria-controls="panel1-content"
|
|
159
|
+ id="panel1-header"
|
|
160
|
+ >
|
|
161
|
+ <Typography variant="body1" sx={{ fontWeight: "500" }} >{productType?.toUpperCase()}</Typography>
|
|
162
|
+ </AccordionSummary>
|
|
163
|
+ <AccordionDetails>
|
|
164
|
+ {(collection?.length > 0) &&
|
|
165
|
+ <Grid container sx={{maxHeight:"1000px", overflow:"scroll", overflowX:"hidden"}}>
|
|
166
|
+ {collection?.map((colletion) => {
|
|
167
|
+ return renderCollectionDisplay(colletion)
|
|
168
|
+ })}
|
|
169
|
+ </Grid>
|
|
170
|
+ }
|
|
171
|
+ </AccordionDetails>
|
|
172
|
+ </Accordion>
|
|
173
|
+ ))}
|
|
174
|
+
|
61
|
175
|
</Box>
|
62
|
176
|
</Drawer>
|
63
|
177
|
);
|