forked from labring/sealos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
37 lines (33 loc) · 912 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Box, Grid, useBreakpointValue } from '@chakra-ui/react';
import { useRouter } from 'next/router';
import dynamic from 'next/dynamic';
const ShowLayoutRoute: Record<string, boolean> = {
'/': true,
'/app': true,
'/deploy': true
};
const AppMenu = dynamic(() => import('./appmenu'), {
ssr: false,
loading: () => <div></div>
});
export default function Layout({ children }: { children: JSX.Element }) {
const router = useRouter();
const firstColumnWidth = useBreakpointValue({ base: '230px', xl: '270px' });
return (
<>
{ShowLayoutRoute[router.pathname] ? (
<Grid
templateColumns={`${firstColumnWidth} 1fr`}
h="100vh"
overflow={'hidden'}
background={'rgba(150, 153, 180, 0.15)'}
>
<AppMenu />
<>{children}</>
</Grid>
) : (
<Box h="100vh">{children}</Box>
)}
</>
);
}