+
{user && (
{user.name || user.email}
@@ -209,6 +212,74 @@ export function Sidebar() {
)}
+ >
+ );
+}
+
+/** The permanent sidebar. Below lg the drawer takes over. */
+export function Sidebar() {
+ return (
+
);
}
+
+/**
+ * The offcanvas below lg. Always mounted so the slide runs in both directions;
+ * closed it is inert (invisible + pointer-events-none) rather than unmounted.
+ */
+export function SidebarDrawer({ open, onClose }: { open: boolean; onClose: () => void }) {
+ const panelRef = useRef
(null);
+
+ useEffect(() => {
+ if (!open) return;
+
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key === "Escape") onClose();
+ };
+ window.addEventListener("keydown", onKey);
+
+ const previousOverflow = document.body.style.overflow;
+ document.body.style.overflow = "hidden";
+
+ panelRef.current?.focus();
+
+ return () => {
+ window.removeEventListener("keydown", onKey);
+ document.body.style.overflow = previousOverflow;
+ };
+ }, [open, onClose]);
+
+ return (
+
+ );
+}