|
@@ -8,11 +8,58 @@ import Box from "@mui/material/Box";
|
8
|
8
|
import Header from "../Header";
|
9
|
9
|
import InputBase from "@mui/material/InputBase";
|
10
|
10
|
import SearchIcon from "@mui/icons-material/Search";
|
|
11
|
+import LocalMallIcon from '@mui/icons-material/LocalMall';
|
11
|
12
|
import AccountCircleIcon from "@mui/icons-material/AccountCircle";
|
|
13
|
+import logoSrc from "../../assets/svg/logo.svg";
|
|
14
|
+import { styled } from '@mui/material/styles';
|
|
15
|
+import { MenuItem, Select, FormControl, Badge } from '@mui/material';
|
|
16
|
+import MobileNav from "./components/MobileNav";
|
|
17
|
+import { TrainRounded } from "@mui/icons-material";
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+const LanguageSelect = styled(Select)(({ theme }) => ({
|
|
23
|
+ backgroundColor: 'black',
|
|
24
|
+ color: 'white',
|
|
25
|
+ border: '1px solid black',
|
|
26
|
+ fontSize: 12,
|
|
27
|
+ '& .MuiSelect-icon': {
|
|
28
|
+ color: 'white',
|
|
29
|
+ },
|
|
30
|
+ '&:hover': {
|
|
31
|
+ backgroundColor: 'white',
|
|
32
|
+ color: 'black',
|
|
33
|
+ },
|
|
34
|
+ '& .MuiMenuItem-root': {
|
|
35
|
+ backgroundColor: 'black',
|
|
36
|
+ color: 'white',
|
|
37
|
+ },
|
|
38
|
+ '& .MuiMenuItem-root:hover': {
|
|
39
|
+ backgroundColor: 'white',
|
|
40
|
+ color: 'black',
|
|
41
|
+ },
|
|
42
|
+}));
|
|
43
|
+
|
|
44
|
+const LanguageSelectItem = styled(MenuItem)(() => ({
|
|
45
|
+ backgroundColor: 'black',
|
|
46
|
+ color: 'white',
|
|
47
|
+ '&:hover': {
|
|
48
|
+ backgroundColor: 'white',
|
|
49
|
+ color: 'black',
|
|
50
|
+ },
|
|
51
|
+}));
|
|
52
|
+
|
12
|
53
|
|
13
|
54
|
const Navbar = () => {
|
|
55
|
+
|
14
|
56
|
const [showHeader, setShowHeader] = useState(true);
|
15
|
57
|
const [lastScrollPos, setLastScrollPos] = useState(0);
|
|
58
|
+ const [language, setLanguage] = useState('English');
|
|
59
|
+
|
|
60
|
+ const handleChange = (event) => {
|
|
61
|
+ setLanguage(event.target.value);
|
|
62
|
+ };
|
16
|
63
|
|
17
|
64
|
useEffect(() => {
|
18
|
65
|
const handleScroll = () => {
|
|
@@ -32,91 +79,142 @@ const Navbar = () => {
|
32
|
79
|
}, [lastScrollPos]);
|
33
|
80
|
|
34
|
81
|
return (
|
35
|
|
- <AppBar position="fixed" sx={{ backgroundColor: "background.black" }}>
|
36
|
|
- {/* Conditionally render the Header */}
|
37
|
|
- {showHeader && <Header />}
|
38
|
|
-
|
39
|
|
- <Toolbar>
|
40
|
|
- {/* Left Section: Logo */}
|
41
|
|
- <Typography
|
42
|
|
- variant="h6"
|
43
|
|
- sx={{
|
44
|
|
- flexGrow: 0,
|
45
|
|
- color: "white",
|
46
|
|
- letterSpacing: 10,
|
47
|
|
- mx: 20,
|
48
|
|
- }}
|
49
|
|
- >
|
50
|
|
- AMBER
|
51
|
|
- </Typography>
|
52
|
|
-
|
53
|
|
- {/* Center Section: Nav Items */}
|
54
|
|
- <Box
|
55
|
|
- sx={{
|
56
|
|
- flexGrow: 1,
|
57
|
|
- display: "flex",
|
58
|
|
- gap: 2,
|
59
|
|
- }}
|
60
|
|
- >
|
61
|
|
- <Button
|
62
|
|
- color="inherit"
|
63
|
|
- onClick={() => {
|
64
|
|
- window.location.href = "/products";
|
65
|
|
- }}
|
66
|
|
- >
|
67
|
|
- DISCOVER
|
68
|
|
- </Button>
|
69
|
|
- <Button
|
70
|
|
- color="inherit"
|
71
|
|
- onClick={() => {
|
72
|
|
- window.location.href = "/";
|
73
|
|
- }}
|
74
|
|
- >
|
75
|
|
- HOME
|
76
|
|
- </Button>
|
77
|
|
- <Button
|
78
|
|
- color="inherit"
|
79
|
|
- onClick={() => {
|
80
|
|
- window.location.href = "/products";
|
81
|
|
- }}
|
82
|
|
- >
|
83
|
|
- BEAUTY
|
84
|
|
- </Button>
|
85
|
|
- <Button
|
86
|
|
- color="inherit"
|
87
|
|
- onClick={() => {
|
88
|
|
- window.location.href = "/products";
|
89
|
|
- }}
|
90
|
|
- >
|
91
|
|
- SALE
|
92
|
|
- </Button>
|
93
|
|
- </Box>
|
|
82
|
+ <>
|
|
83
|
+ <AppBar position="fixed"
|
|
84
|
+ sx={{
|
|
85
|
+ backgroundColor: {
|
|
86
|
+ xs: "rgba(0,0,0,0)",
|
|
87
|
+ md: "rgba(0,0,0,0.9)",
|
|
88
|
+ lg: "background.black"
|
|
89
|
+ },
|
|
90
|
+ boxShadow: {
|
|
91
|
+ xs: "none",
|
|
92
|
+ md: "none",
|
|
93
|
+ lg: "0px 2px 4px -1px rgba(0,0,0,0.2),0px 4px 5px 0px rgba(0,0,0,0.14),0px 1px 10px 0px rgba(0,0,0,0.12)"
|
|
94
|
+ }
|
|
95
|
+ }}
|
|
96
|
+ >
|
94
|
97
|
|
95
|
|
- {/* Right Section: Search and Profile */}
|
96
|
|
- <Box sx={{ display: "flex", alignItems: "center", marginRight: 20 }}>
|
|
98
|
+ {/* Conditionally render the Header */}
|
|
99
|
+ {showHeader && <Header />}
|
|
100
|
+
|
|
101
|
+ <Toolbar sx={{
|
|
102
|
+ px: {
|
|
103
|
+ xs: 2,
|
|
104
|
+ md: 10,
|
|
105
|
+ lg: 20
|
|
106
|
+ },
|
|
107
|
+ py: 0.5
|
|
108
|
+ }} disableGutters>
|
|
109
|
+
|
|
110
|
+ {/* Left Section: Logo */}
|
|
111
|
+ <Box sx={{
|
|
112
|
+ display:{
|
|
113
|
+ xs:"none",
|
|
114
|
+ md:"none",
|
|
115
|
+ lg:"block"
|
|
116
|
+ }
|
|
117
|
+ }}>
|
|
118
|
+ <img src={logoSrc} alt="Logo"
|
|
119
|
+ style={{
|
|
120
|
+ width: 150,
|
|
121
|
+ height: 50,
|
|
122
|
+ }} />
|
|
123
|
+ </Box>
|
|
124
|
+
|
|
125
|
+ {/* Center Section: Nav Items */}
|
97
|
126
|
<Box
|
98
|
127
|
sx={{
|
99
|
|
- display: "flex",
|
100
|
|
- alignItems: "center",
|
101
|
|
- backgroundColor: "rgba(255, 255, 255, 0.15)",
|
102
|
|
- borderRadius: 1,
|
103
|
|
- padding: "0 8px",
|
|
128
|
+ flexGrow: 1,
|
|
129
|
+ display: {
|
|
130
|
+ xs: "none",
|
|
131
|
+ md: "none",
|
|
132
|
+ lg: "flex"
|
|
133
|
+ },
|
|
134
|
+ gap: 2,
|
104
|
135
|
}}
|
105
|
136
|
>
|
106
|
|
- <SearchIcon />
|
107
|
|
- <InputBase
|
108
|
|
- placeholder="Search…"
|
|
137
|
+ <Button
|
|
138
|
+ color="inherit"
|
|
139
|
+ onClick={() => {
|
|
140
|
+ window.location.href = "/products";
|
|
141
|
+ }}
|
|
142
|
+ >
|
|
143
|
+ DISCOVER
|
|
144
|
+ </Button>
|
|
145
|
+ <Button
|
|
146
|
+ color="inherit"
|
|
147
|
+ onClick={() => {
|
|
148
|
+ window.location.href = "/";
|
|
149
|
+ }}
|
|
150
|
+ >
|
|
151
|
+ HOME
|
|
152
|
+ </Button>
|
|
153
|
+ <Button
|
|
154
|
+ color="inherit"
|
|
155
|
+ onClick={() => {
|
|
156
|
+ window.location.href = "/products";
|
|
157
|
+ }}
|
|
158
|
+ >
|
|
159
|
+ BEAUTY
|
|
160
|
+ </Button>
|
|
161
|
+ <Button
|
|
162
|
+ color="inherit"
|
|
163
|
+ onClick={() => {
|
|
164
|
+ window.location.href = "/products";
|
|
165
|
+ }}
|
|
166
|
+ >
|
|
167
|
+ SALE
|
|
168
|
+ </Button>
|
|
169
|
+ </Box>
|
|
170
|
+
|
|
171
|
+ {/* Right Section: Search and Profile */}
|
|
172
|
+ <Box sx={{ display: "flex", alignItems: "center", gap: 1.2, ml: "auto" }}>
|
|
173
|
+
|
|
174
|
+ <FormControl
|
109
|
175
|
sx={{
|
110
|
|
- color: "inherit",
|
|
176
|
+ display: {
|
|
177
|
+ xs: "none",
|
|
178
|
+ lg: "block"
|
|
179
|
+ }
|
111
|
180
|
}}
|
112
|
|
- />
|
|
181
|
+ >
|
|
182
|
+ <LanguageSelect
|
|
183
|
+ value={language}
|
|
184
|
+ onChange={handleChange}
|
|
185
|
+ label=""
|
|
186
|
+ MenuProps={{
|
|
187
|
+ PaperProps: {
|
|
188
|
+ style: {
|
|
189
|
+ backgroundColor: 'black',
|
|
190
|
+ color: 'white'
|
|
191
|
+ },
|
|
192
|
+ },
|
|
193
|
+ }}
|
|
194
|
+ >
|
|
195
|
+ <LanguageSelectItem value="English">English</LanguageSelectItem>
|
|
196
|
+ <LanguageSelectItem value="Malay">Malay</LanguageSelectItem>
|
|
197
|
+ <LanguageSelectItem value="Chinese">Chinese</LanguageSelectItem>
|
|
198
|
+ </LanguageSelect>
|
|
199
|
+ </FormControl>
|
|
200
|
+
|
|
201
|
+ <IconButton color="inherit">
|
|
202
|
+ <SearchIcon sx={{ color: "white" }} />
|
|
203
|
+ </IconButton>
|
|
204
|
+
|
|
205
|
+ <Badge badgeContent={1} color="primary">
|
|
206
|
+ <LocalMallIcon color="action" sx={{ color: "white" }} />
|
|
207
|
+ </Badge>
|
|
208
|
+
|
|
209
|
+ <IconButton color="inherit">
|
|
210
|
+ <AccountCircleIcon sx={{ color: "white" }} />
|
|
211
|
+ </IconButton>
|
113
|
212
|
</Box>
|
114
|
|
- <IconButton color="inherit">
|
115
|
|
- <AccountCircleIcon sx={{ color: "white" }} />
|
116
|
|
- </IconButton>
|
117
|
|
- </Box>
|
118
|
|
- </Toolbar>
|
119
|
|
- </AppBar>
|
|
213
|
+
|
|
214
|
+ </Toolbar>
|
|
215
|
+ </AppBar>
|
|
216
|
+ {/* <MobileNav open={true} menu={[]}/> */}
|
|
217
|
+ </>
|
120
|
218
|
);
|
121
|
219
|
};
|
122
|
220
|
|