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

75 lines
2.5 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';
import { useAuth } from '../hooks/useAuth';
import { TaskboardLogo } from './TaskboardLogo';
2026-02-24 08:52:57 +00:00
export function Navbar() {
2026-02-25 09:29:45 +00:00
const { user } = useApp();
const { logout } = useAuth();
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 gap-3">
<Link to="/boards" className="hover:opacity-80 transition-opacity">
<TaskboardLogo className="h-8 w-auto" />
</Link>
2026-02-25 09:29:45 +00:00
<Link
to="/boards"
2026-02-25 09:29:45 +00:00
className="text-xl font-bold text-white hover:text-blue-400 transition-colors"
>
Taskboard
2026-02-24 08:52:57 +00:00
</Link>
<div className="ml-10 flex items-baseline space-x-4">
<Link
to="/home"
2026-02-24 08:52:57 +00:00
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
>
Home
</Link>
2026-02-24 08:52:57 +00:00
{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>
2026-02-24 08:52:57 +00:00
)}
</div>
</div>
<div className="flex items-center gap-3">
2026-02-24 08:52:57 +00:00
{user ? (
<>
<span className="text-gray-300 px-3 py-2">{user.username}</span>
<button
onClick={logout}
className="text-gray-300 hover:text-white px-3 py-2 rounded-md text-sm font-medium transition-colors"
>
Logout
</button>
</>
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
);
}