mirror of
https://github.com/DefectingCat/DefectingCat.github.io
synced 2025-07-15 16:51:37 +00:00
* remove nprogress * fix loading issue Add absolute import path aliases * optimization imports Add fallback on navbar image Fix post images zoom wrapper as button Fix module.css import error * add router prefetch to post page Add paging prefetch * add post comment component
40 lines
901 B
TypeScript
40 lines
901 B
TypeScript
import useGetColors from 'lib/hooks/useGetColors';
|
|
import { FC } from 'react';
|
|
import { Flex, Fade } from '@chakra-ui/react';
|
|
import UseAnimations from 'react-useanimations';
|
|
import arrowUp from 'react-useanimations/lib/arrowUp';
|
|
|
|
interface Props {
|
|
showBacktop: boolean;
|
|
backToTop: () => void;
|
|
}
|
|
|
|
const BackToTop: FC<Props> = ({ showBacktop, backToTop }) => {
|
|
const { boxBg } = useGetColors();
|
|
|
|
return (
|
|
<>
|
|
<Fade in={showBacktop}>
|
|
<Flex
|
|
bg={boxBg}
|
|
w="40px"
|
|
h="40px"
|
|
justify="center"
|
|
alignItems="center"
|
|
rounded="full"
|
|
shadow="card"
|
|
position="fixed"
|
|
bottom="50px"
|
|
right="100px"
|
|
onClick={backToTop}
|
|
cursor="pointer"
|
|
>
|
|
<UseAnimations size={32} animation={arrowUp} />
|
|
</Flex>
|
|
</Fade>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default BackToTop;
|