feat: add router config, router, and sidenav config
This commit is contained in:
46
src/components/Layout/Layout.tsx
Normal file
46
src/components/Layout/Layout.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import { SideNav } from '@rkheftan/harmony-ui';
|
||||
import { buildNavItems } from './navItems';
|
||||
import { appRoutes } from '@/routes/config';
|
||||
import { Outlet, useLocation } from 'react-router-dom';
|
||||
import { Box } from '@mui/material';
|
||||
import { grey } from '@mui/material/colors';
|
||||
|
||||
export const Layout = () => {
|
||||
const navItemConfigs = buildNavItems(appRoutes);
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
height: '100vh',
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
width: 1070,
|
||||
height: '80%',
|
||||
display: 'flex',
|
||||
flexDirection: 'row-reverse',
|
||||
borderRadius: 4,
|
||||
backgroundColor: 'background.paper',
|
||||
overflow: 'hidden',
|
||||
padding: 1,
|
||||
}}
|
||||
>
|
||||
<Box sx={{ flex: 1 }}>
|
||||
<Outlet />
|
||||
</Box>
|
||||
|
||||
<SideNav
|
||||
navConfig={navItemConfigs}
|
||||
activePath={location.pathname + location.hash}
|
||||
selectedVariant="textOnly"
|
||||
positioning="absolute"
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user