-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNavbar.js
49 lines (46 loc) · 1.34 KB
/
Navbar.js
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
import React, { useState } from "react";
import "./Navbar.css";
import { Link } from "react-router-dom";
import * as FaIcons from "react-icons/fa";
import { SidebarData } from "./SidebarData";
function Navbar() {
const [sidebar, setSidebar] = useState(false);
const showSidebar = () => {
setSidebar(!sidebar);
};
return (
<>
<div className="navbar">
<Link to="#" className="nav-menu-icon" onClick={showSidebar}>
<FaIcons.FaBars />
</Link>
</div>
<div
className={sidebar ? "sidebar-container active" : "sidebar-container"}
>
<ul className="sidebar-items">
<li className="sidebar-toggle">
<Link to="#" className="nav-menu-icon" onClick={showSidebar}>
<FaIcons.FaWindowClose />
</Link>
</li>
{SidebarData.map((sidebaritem) => {
return (
<li
key={sidebaritem.id}
className={sidebaritem.cName}
onClick={showSidebar}
>
<Link to={sidebaritem.path}>
{sidebaritem.icon}
<span>{sidebaritem.title}</span>
</Link>
</li>
);
})}
</ul>
</div>
</>
);
}
export default Navbar;