-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMobileMenu.jsx
More file actions
73 lines (65 loc) · 1.98 KB
/
Copy pathMobileMenu.jsx
File metadata and controls
73 lines (65 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React, { useState } from "react";
import Drawer from "@mui/material/Drawer";
import IconButton from "@mui/material/IconButton";
import MenuIcon from "@mui/icons-material/Menu";
import CloseIcon from "@mui/icons-material/Close";
import AutoAwesomeOutlinedIcon from "@mui/icons-material/AutoAwesomeOutlined";
import UserInfo from "./UserInfo";
import { MainNavList, SecondaryNavList } from "./NavItems";
function MobileMenu() {
const [isOpen, setIsOpen] = useState(false);
const toggleDrawer = (open) => (event) => {
if (
event.type === "keydown" &&
(event.key === "Tab" || event.key === "Shift")
) {
return;
}
setIsOpen(open);
};
const handleLinkClick = () => {
setIsOpen(false);
};
return (
<>
<IconButton
edge="start"
color="inherit"
aria-label="Open navigation menu"
aria-expanded={isOpen}
onClick={toggleDrawer(true)}
className="lg:hidden text-black"
>
<MenuIcon />
</IconButton>
<Drawer
anchor="left"
open={isOpen}
onClose={toggleDrawer(false)}
aria-label="Navigation menu"
>
<div className="w-64 h-full bg-white">
<div className="flex justify-between items-center p-4 border-b border-gray-300">
<span className="text-xl font-bold">
<span className="text-blue-500">
<AutoAwesomeOutlinedIcon />
</span>
Stickerlandia
</span>
<IconButton onClick={toggleDrawer(false)} aria-label="Close navigation menu">
<CloseIcon />
</IconButton>
</div>
<UserInfo />
<nav className="flex-1">
<MainNavList onItemClick={handleLinkClick} />
</nav>
<nav className="border-t border-gray-300 mt-auto">
<SecondaryNavList onItemClick={handleLinkClick} />
</nav>
</div>
</Drawer>
</>
);
}
export default MobileMenu;