import React from "react"; import { Flex, Drawer, DrawerOverlay, DrawerContent, useBreakpointValue, } from "@chakra-ui/react"; import { Sidebar } from "./Sidebar"; import { useWindowSize } from "../hooks/useWindowSize"; interface ILayoutProps { isSidebarOpen: boolean; onSidebarClose(): void; onSidebarOpen(): void; } const DARK_BG = { bg: "gray.900", }; const ML = { base: 0, md: 80, }; export const Layout: React.FC> = ({ children, isSidebarOpen, onSidebarClose, }) => { const [width, height] = useWindowSize(); const breakpointDisplay = useBreakpointValue({ base: "none", md: "unset", }); return ( {breakpointDisplay === "unset" && } {/* Lazy load this sidebar */} {isSidebarOpen && ( )} {children} ); };