-
Notifications
You must be signed in to change notification settings - Fork 0
/
Navbar.jsx
56 lines (52 loc) · 1.39 KB
/
Navbar.jsx
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
import { useState } from "react";
import "./Navbar.css"; // Import the CSS file
import { useAuth } from "./AuthContext";
const Navbar = () => {
const [showMenu, setShowMenu] = useState(false);
const { user, signInWithGoogle, handleLogout } = useAuth();
const toggleMenu = () => {
setShowMenu(!showMenu);
};
return (
<nav className="navbar">
<h2>Eventography</h2>
<div className={`menu ${showMenu ? "show" : ""}`}>
<ul>
{!user && (
<li>
<a href="/">Home</a>
</li>
)}
{user ? (
<>
<li>
<a href="/profile">Profile</a>
</li>
<li>
<a href={`/events/${user.uid}`}>Event</a>
</li>
<li>
<a href={`/galleries/${user.uid}`}>Gallery</a>
</li>
<li>
<button onClick={handleLogout}>Logout</button>
</li>
</>
) : (
<>
<li>
<button onClick={signInWithGoogle}>Login</button>
</li>
</>
)}
</ul>
</div>
<div className="hamburger-menu" onClick={toggleMenu}>
<div className="line"></div>
<div className="line"></div>
<div className="line"></div>
</div>
</nav>
);
};
export default Navbar;