mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-16 01:01:38 +00:00
* add dark mode switch button * modify footer * fix nav menu opening issue * add paging number * remove post card a link focus shadow * add _document * remove archive card border on last child * add post image zoom margin on desktop * add post index image * remove TOC scroll bar on firefox
64 lines
1.6 KiB
TypeScript
64 lines
1.6 KiB
TypeScript
import { FC, useRef } from 'react';
|
|
import NavBar from '../components/NavBar';
|
|
import { Box, Flex } from '@chakra-ui/react';
|
|
import Footer from '../components/Footer';
|
|
import { BackTop } from 'antd';
|
|
import UseAnimations from 'react-useanimations';
|
|
import arrowUp from 'react-useanimations/lib/arrowUp';
|
|
import useGetColors from '../lib/hooks/useGetColors';
|
|
|
|
const HomeLayout: FC = ({ children }) => {
|
|
const wrapperRef = useRef(null);
|
|
|
|
const { boxBg } = useGetColors();
|
|
|
|
return (
|
|
<>
|
|
<Flex
|
|
justify={'center'}
|
|
overflow="auto"
|
|
h={['unset', 'unset', '100vh']}
|
|
px={['1rem', '1rem', '3rem']}
|
|
flexFlow={['column', 'column', 'row']}
|
|
ref={wrapperRef}
|
|
>
|
|
{/* Here is NavBar on the left */}
|
|
<Flex
|
|
as="header"
|
|
position={'sticky'}
|
|
top={['0', '0', '3rem']}
|
|
w={[null, null, '120px', '11rem']}
|
|
mr={[null, null, '3rem']}
|
|
mt={[null, null, '3rem']}
|
|
>
|
|
<NavBar />
|
|
</Flex>
|
|
|
|
{/* Content */}
|
|
<Box mt={['1rem', null, '3rem']} as="main">
|
|
{children}
|
|
<Footer />
|
|
</Box>
|
|
</Flex>
|
|
|
|
<BackTop
|
|
target={() => (wrapperRef.current ? wrapperRef.current : document.body)}
|
|
>
|
|
<Flex
|
|
bg={boxBg}
|
|
w="40px"
|
|
h="40px"
|
|
justify="center"
|
|
alignItems="center"
|
|
rounded="full"
|
|
shadow="card"
|
|
>
|
|
<UseAnimations size={32} animation={arrowUp} />
|
|
</Flex>
|
|
</BackTop>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default HomeLayout;
|