kanban-app/frontend/src/components/Navbar.tsx

80 lines
2.7 KiB
TypeScript
Raw Normal View History

2026-02-25 09:29:45 +00:00
import { Link } from 'react-router-dom';
import { useApp } from '../context/AppContext';
2026-02-24 08:52:57 +00:00
export function Navbar() {
2026-02-25 09:29:45 +00:00
const { user } = useApp();
2026-02-24 08:52:57 +00:00
return (
<nav className="bg-gray-800 border-b border-gray-700 shadow-md">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex items-center justify-between h-16">
<div className="flex items-center">
2026-02-25 09:29:45 +00:00
<Link
to="/"
className="text-xl font-bold text-white hover:text-blue-400 transition-colors"
>
2026-02-24 08:52:57 +00:00
Crafting Shop
</Link>
<div className="ml-10 flex items-baseline space-x-4">
<Link
to="/"
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
>
Home
</Link>
<Link
to="/products"
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
>
Products
</Link>
<Link
to="/cart"
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
>
Cart
</Link>
{user && (
<>
<Link
to="/boards"
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
>
Boards
</Link>
<Link
to="/orders"
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
>
Orders
</Link>
</>
2026-02-24 08:52:57 +00:00
)}
</div>
</div>
<div className="flex items-center">
{user ? (
2026-02-25 09:29:45 +00:00
<span className="text-gray-300 px-3 py-2">{user.username}</span>
2026-02-24 08:52:57 +00:00
) : (
<>
<Link
to="/login"
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
>
Login
</Link>
<Link
to="/register"
className="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium transition-colors"
>
Register
</Link>
</>
)}
</div>
</div>
</div>
</nav>
2026-02-25 09:29:45 +00:00
);
}