-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNavbar.js
More file actions
46 lines (32 loc) · 1.23 KB
/
Navbar.js
File metadata and controls
46 lines (32 loc) · 1.23 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
import React, { useState } from "react";
import { Link } from "react-router-dom";
import "../components/Navbar.css"; // ✅ Ensure CSS path is correct
import SellForm from "../components/SellForm"; // ✅ Corrected Import
const Navbar = ({ username, onLogout }) => {
const [isSellModalOpen, setSellModalOpen] = useState(false);
return (
<>
<nav className="navbar">
<div className="nav-left">
<Link to="/" className="nav-logo">Ecobuy</Link>
<Link to="/" className="nav-item">Home</Link>
<button
className="nav-item sell-button"
onClick={() => setSellModalOpen(true)}
>
Sell
</button>
<Link to="/categories" className="nav-item">Categories</Link>
<Link to="/cart" className="nav-item">🛒 Cart</Link>
</div>
<div className="nav-right">
<span className="username">{username}</span>
<button className="logout-button" onClick={onLogout}>Logout</button>
</div>
</nav>
{/* ✅ Sell Form Modal - Opens when Sell button is clicked */}
{isSellModalOpen && <SellForm onClose={() => setSellModalOpen(false)} />}
</>
);
};
export default Navbar;