Greg
Claude Opus 4.7 (1M context)
fix(ta-01): replace mobile topbar with floating hamburger button
d456a34
Raw History Blame Contribute Delete
1.14 kB
import { Outlet, useLocation } from 'react-router-dom';
import { useState, useEffect } from 'react';
import { Menu } from 'lucide-react';
import Sidebar from './Sidebar';
export default function Layout() {
const [mobileOpen, setMobileOpen] = useState(false);
const location = useLocation();
// Close drawer whenever the route changes.
useEffect(() => {
setMobileOpen(false);
}, [location.pathname]);
return (
<div className="app-layout">
{/* Floating hamburger (mobile only, no full topbar) */}
<button
type="button"
onClick={() => setMobileOpen(true)}
aria-label="Abrir menú"
className="mobile-menu-fab md:hidden"
>
<Menu size={20} />
</button>
{/* Backdrop for mobile drawer */}
{mobileOpen && (
<div
className="fixed inset-0 bg-black/50 z-30 md:hidden"
onClick={() => setMobileOpen(false)}
aria-hidden="true"
/>
)}
<Sidebar mobileOpen={mobileOpen} onClose={() => setMobileOpen(false)} />
<main className="main-content">
<Outlet />
</main>
</div>
);
}