-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNavItems.jsx
More file actions
77 lines (70 loc) · 2.46 KB
/
Copy pathNavItems.jsx
File metadata and controls
77 lines (70 loc) · 2.46 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
74
75
76
77
import React from "react";
import { Link } from "react-router";
import { useAuth } from "../context/AuthContext";
import HomeOutlinedIcon from "@mui/icons-material/HomeOutlined";
import MenuBookOutlinedIcon from "@mui/icons-material/MenuBookOutlined";
import AssessmentOutlinedIcon from "@mui/icons-material/AssessmentOutlined";
import LocalPrintshopOutlinedIcon from "@mui/icons-material/LocalPrintshopOutlined";
import PersonOutlineOutlinedIcon from "@mui/icons-material/PersonOutlineOutlined";
import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
import LogoutOutlinedIcon from "@mui/icons-material/LogoutOutlined";
const mainNavItems = [
{ to: "/dashboard", icon: HomeOutlinedIcon, label: "User Dashboard" },
{ to: "/collection", icon: MenuBookOutlinedIcon, label: "My Collection" },
{ to: "/catalogue", icon: AssessmentOutlinedIcon, label: "Catalogue" },
{ to: "/public-dashboard", icon: AssessmentOutlinedIcon, label: "Public Dashboard" },
{ to: "", icon: LocalPrintshopOutlinedIcon, label: "Print Station", isExternal: true },
];
const secondaryNavItems = [
{ to: "", icon: PersonOutlineOutlinedIcon, label: "Profile", isExternal: true },
{ to: "", icon: SettingsOutlinedIcon, label: "Settings", isExternal: true },
];
function MainNavList({ onItemClick }) {
return (
<ul>
{mainNavItems.map((item) => (
<li key={item.label} className="my-3 px-5">
{item.isExternal ? (
<a className="block py-2" href={item.to} onClick={onItemClick}>
<item.icon />
{item.label}
</a>
) : (
<Link className="block py-2" to={item.to} onClick={onItemClick}>
<item.icon />
{item.label}
</Link>
)}
</li>
))}
</ul>
);
}
function SecondaryNavList({ onItemClick }) {
const { logout } = useAuth();
const handleLogout = () => {
if (onItemClick) {
onItemClick();
}
logout();
};
return (
<ul>
{secondaryNavItems.map((item) => (
<li key={item.label} className="my-3 px-5">
<a className="block py-2" href={item.to} onClick={onItemClick}>
<item.icon />
{item.label}
</a>
</li>
))}
<li className="my-3 px-5">
<button className="block w-full text-left py-2" onClick={handleLogout}>
<LogoutOutlinedIcon />
Sign Out
</button>
</li>
</ul>
);
}
export { MainNavList, SecondaryNavList };