-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathNavbar.tsx
More file actions
50 lines (44 loc) · 1.92 KB
/
Navbar.tsx
File metadata and controls
50 lines (44 loc) · 1.92 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
'use client'
import Link from 'next/link'
import { useState } from 'react'
import { Menu, X } from "lucide-react"
export default function Navbar() {
const [isOpen, setIsOpen] = useState(false)
return (
<nav className="fixed top-0 left-0 w-full bg-gray-900 text-white shadow-md z-50">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex justify-between h-16 items-center">
{/* Logo */}
<Link href="/" className="text-xl font-bold">
WorkerHub
</Link>
{/* Desktop Links */}
<div className="hidden md:flex space-x-6">
<Link href="/" className="hover:text-blue-400 transition">Home</Link>
<Link href="/workers" className="hover:text-blue-400 transition">Workers</Link>
<Link href="/about" className="hover:text-blue-400 transition">About</Link>
<Link href="/contact" className="hover:text-blue-400 transition">Contact</Link>
</div>
{/* Mobile Menu Button */}
<button
className="md:hidden p-2"
onClick={() => setIsOpen(!isOpen)}
>
{isOpen ? <X size={24} /> : <Menu size={24} />}
</button>
</div>
</div>
{/* Mobile Menu */}
{isOpen && (
<div className="md:hidden bg-gray-800">
<div className="flex flex-col space-y-2 p-4">
<Link href="/" className="hover:text-blue-400 transition" onClick={() => setIsOpen(false)}>Home</Link>
<Link href="/workers" className="hover:text-blue-400 transition" onClick={() => setIsOpen(false)}>Workers</Link>
<Link href="/about" className="hover:text-blue-400 transition" onClick={() => setIsOpen(false)}>About</Link>
<Link href="/contact" className="hover:text-blue-400 transition" onClick={() => setIsOpen(false)}>Contact</Link>
</div>
</div>
)}
</nav>
)
}