https://dev.kronoz.win/r/marzneshin.git
1import { Box, VStack } from '@chakra-ui/react';
2import { FC, PropsWithChildren, useEffect } from 'react';
3import { useDashboard } from 'stores';
4import { PageType } from 'types';
5
6const usePage = (page: PageType) => {
7 useEffect(() => {
8 useDashboard.getState().activatePage(page);
9 }, []);
10};
11
12type PageProp = {
13 page: PageType;
14}
15
16export const Page: FC<PropsWithChildren<PageProp>> = ({ page, children }) => {
17 usePage(page);
18
19 return (
20 <VStack justifyContent="space-between" mt={4} rowGap={4}>
21 <Box w="full">
22 {children}
23 </Box>
24 </VStack>
25 );
26};
27
28export default Page;