-
Notifications
You must be signed in to change notification settings - Fork 0
/
Navbar.jsx
44 lines (35 loc) · 1.2 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
import {FaShoppingCart} from "react-icons/fa"
import { useSelector } from "react-redux";
import { NavLink } from "react-router-dom";
const Navbar = () => {
const {cart} = useSelector((state) => state);
return (
<div >
<nav className="flex justify-between items-center h-20 max-w-6xl mx-auto">
<NavLink to="/">
<div className="ml-5">
<img src="../logo.png" className="h-14"/>
</div>
</NavLink>
<div className="flex items-center font-medium text-slate-100 mr-5 space-x-6">
<NavLink to="/">
<p>Home</p>
</NavLink>
<NavLink to="/cart">
<div className="relative">
<FaShoppingCart className="text-2xl"/>
{
cart.length > 0 &&
<span
className="absolute -top-1 -right-2 bg-green-600 text-xs w-5 h-5 flex
justify-center items-center animate-bounce rounded-full text-white"
>{cart.length}</span>
}
</div>
</NavLink>
</div>
</nav>
</div>
)
};
export default Navbar;