2022-01-19 16:50:25 +00:00
|
|
|
import {
|
|
|
|
Box,
|
|
|
|
Drawer,
|
|
|
|
DrawerContent,
|
|
|
|
useDisclosure,
|
|
|
|
useColorModeValue,
|
|
|
|
} from '@chakra-ui/react';
|
|
|
|
import React, { ReactNode } from 'react';
|
|
|
|
import { Sidebar, MobileNav } from '../components/Menu';
|
2022-01-15 15:45:46 +00:00
|
|
|
|
2022-01-19 16:50:25 +00:00
|
|
|
export function DashboardLayout({ children }: { children: ReactNode }) {
|
|
|
|
const { isOpen, onOpen, onClose } = useDisclosure();
|
2022-01-17 07:33:28 +00:00
|
|
|
return (
|
2022-01-19 16:50:25 +00:00
|
|
|
<Box minH="100vh" bg={useColorModeValue('gray.100', 'gray.900')}>
|
|
|
|
<Sidebar
|
|
|
|
onClose={() => onClose}
|
|
|
|
display={{ base: 'none', md: 'block' }}
|
|
|
|
/>
|
|
|
|
<Drawer
|
|
|
|
autoFocus={false}
|
|
|
|
isOpen={isOpen}
|
|
|
|
placement="left"
|
|
|
|
onClose={onClose}
|
|
|
|
returnFocusOnClose={false}
|
|
|
|
onOverlayClick={onClose}
|
|
|
|
size="full"
|
|
|
|
>
|
|
|
|
<DrawerContent>
|
|
|
|
<Sidebar onClose={onClose} />
|
|
|
|
</DrawerContent>
|
|
|
|
</Drawer>
|
|
|
|
{/* mobilenav */}
|
|
|
|
<MobileNav onOpen={onOpen} />
|
|
|
|
<Box ml={{ base: 0, md: 60 }} p="4" pt="24">
|
2022-01-17 07:33:28 +00:00
|
|
|
{children}
|
|
|
|
</Box>
|
2022-01-19 16:50:25 +00:00
|
|
|
</Box>
|
2022-01-17 07:33:28 +00:00
|
|
|
);
|
2022-01-15 15:45:46 +00:00
|
|
|
}
|