/* Copyright 2026 Marimo. All rights reserved. */ import { useSlot } from "@marimo-team/react-slotz"; import { useAtom } from "jotai"; import type React from "react"; import { SlotNames } from "@/core/slots/slots"; import { SheetMenu } from "./sheet-sidebar"; import { Sidebar } from "./sidebar"; import { normalizeWidth, sidebarAtom } from "./state"; interface Props { children: React.ReactNode; } export const WrappedWithSidebar: React.FC = ({ children }) => { const [{ isOpen, width }, dispatch] = useAtom(sidebarAtom); const elements = useSlot(SlotNames.SIDEBAR); if (elements.length === 0) { return children; } const openWidth = normalizeWidth(width); return (
dispatch({ type: "toggle", isOpen: !isOpen })} />
{children}
); };