Spaces:
Sleeping
Sleeping
Download frontend/src/components/Layout.jsx from avborg/adventure-log: direct link, hf CLI and curl.
- Browser
- Download file 1.53 kB
-
https://huggingface.co/spaces/avborg/adventure-log/resolve/main/frontend/src/components/Layout.jsx
- Command line
-
hf download hf://spaces/avborg/adventure-log/frontend/src/components/Layout.jsx
-
curl -L -o Layout.jsx https://huggingface.co/spaces/avborg/adventure-log/resolve/main/frontend/src/components/Layout.jsx
1.53 kB
| import { Link, Outlet, useNavigate } from 'react-router-dom' | |
| import { useAuth } from '../hooks/useAuth' | |
| export default function Layout() { | |
| const { user, logout } = useAuth() | |
| const navigate = useNavigate() | |
| function handleLogout() { | |
| logout() | |
| navigate('/login') | |
| } | |
| return ( | |
| <div className="min-h-screen bg-gray-50"> | |
| <header className="bg-white shadow-sm"> | |
| <div className="max-w-5xl mx-auto px-4 py-3 flex items-center justify-between"> | |
| <Link to="/" className="text-xl font-bold text-emerald-600"> | |
| Рецепты | |
| </Link> | |
| <div className="flex items-center gap-4"> | |
| <Link to="/" className="text-sm text-gray-600 hover:text-gray-900">Все рецепты</Link> | |
| <Link to="/?favorites_only=true" className="text-sm text-gray-600 hover:text-gray-900">Избранное</Link> | |
| <Link to="/shopping" className="text-sm text-gray-600 hover:text-gray-900">🛒 Покупки</Link> | |
| <Link to="/recipes/new" className="bg-emerald-600 text-white text-sm px-3 py-1.5 rounded-lg hover:bg-emerald-700"> | |
| + Добавить | |
| </Link> | |
| <span className="text-sm text-gray-500">{user?.name}</span> | |
| <button onClick={handleLogout} className="text-sm text-gray-500 hover:text-gray-900"> | |
| Выйти | |
| </button> | |
| </div> | |
| </div> | |
| </header> | |
| <main className="max-w-5xl mx-auto px-4 py-8"> | |
| <Outlet /> | |
| </main> | |
| </div> | |
| ) | |
| } | |