components.layout.common.SidebarLayout.tsx Maven / Gradle / Ivy
import LayoutContextProvider, { BannerProps, LayoutConfigProps, SidebarProps } from 'contexts/LayoutContext';
import { useBannerState, useLayoutContext } from 'hooks/layout';
import { DivProps } from 'types/react';
import SidebarLayoutSidebar from 'components/layout/sidebar/Sidebar';
import SidebarLayoutContent from 'components/layout/sidebar/Content';
import { Box, } from '@mui/material';
interface SidebarLayoutProps extends Partial {
name: string,
bannerProps?: Partial,
sidebarProps?: Partial,
children: React.ReactNode
}
const SidebarLayout = ({children, name, bannerProps, sidebarProps, ...layoutProps}: SidebarLayoutProps): JSX.Element => {
return (
{children}
)
}
const LayoutBody = ({children}: DivProps) => {
const {sidebarProps: {enabled}, props: {side, withBanner}, bannerProps: {shortcut}, name} = useLayoutContext()
const [bannerState, setBannerState] = useBannerState(withBanner, shortcut)
return (
theme.palette.background.default,
display: "flex",
flexDirection: "row",
overflow: 'hidden',
}}
>
{side == "left" ? : null}
{children}
{side == "right" ? : null}
)
}
export default SidebarLayout