-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathNavBar.jsx
More file actions
58 lines (55 loc) · 2.35 KB
/
NavBar.jsx
File metadata and controls
58 lines (55 loc) · 2.35 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
import { ShoppingBagIcon } from "@heroicons/react/outline";
import React from "react";
export default function NavBar({ setOpen, cart }) {
return (
<div className="bg-white">
<header className="relative">
<nav aria-label="Top">
<div className="bg-white">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="border-b border-gray-200">
<div className="h-16 flex items-center justify-between">
{/* Logo (lg+) */}
<div className="hidden lg:flex-1 lg:flex lg:items-center">
<a href="#">
<span className="sr-only">Workflow</span>
<img
className="h-8 w-auto"
src="https://tailwindui.com/img/logos/workflow-mark.svg?color=black&shade=600"
alt=""
/>
</a>
</div>
{/* Logo (lg-) */}
<a href="#" className="lg:hidden">
<span className="sr-only">Workflow</span>
<img
src="https://tailwindui.com/img/logos/workflow-mark.svg?color=black&shade=600"
alt=""
className="h-8 w-auto"
/>
</a>
<div className="flex-1 flex items-center justify-end">
<div className="flex items-center lg:ml-8">
{/* Cart Icon */}
<div className="ml-4 flow-root lg:ml-8">
<button onClick={() => setOpen(true)} className="group -m-2 p-2 flex items-center">
<ShoppingBagIcon
className="flex-shrink-0 h-6 w-6 text-gray-400 group-hover:text-gray-500"
aria-hidden="true"
/>
<span className="ml-2 text-sm font-medium text-gray-700 group-hover:text-gray-800">{cart.length}</span>
<span className="sr-only">items in cart, view bag</span>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</nav>
</header>
</div>
);
}