Add styles to base page

This commit is contained in:
jeffvli
2022-12-14 19:17:35 -08:00
parent c1c70ff576
commit 810a98a4b6
@@ -1,4 +1,5 @@
import type { ReactNode } from 'react'; import type { ReactNode, Ref } from 'react';
import { forwardRef } from 'react';
import { motion } from 'framer-motion'; import { motion } from 'framer-motion';
import styled from 'styled-components'; import styled from 'styled-components';
@@ -7,8 +8,12 @@ interface AnimatedPageProps {
} }
const StyledAnimatedPage = styled(motion.div)` const StyledAnimatedPage = styled(motion.div)`
position: relative;
display: flex;
flex-direction: column;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: hidden;
`; `;
const variants = { const variants = {
@@ -17,16 +22,19 @@ const variants = {
initial: { opacity: 0 }, initial: { opacity: 0 },
}; };
export const AnimatedPage = ({ children }: AnimatedPageProps) => { export const AnimatedPage = forwardRef(
return ( ({ children }: AnimatedPageProps, ref: Ref<HTMLDivElement>) => {
<StyledAnimatedPage return (
animate="animate" <StyledAnimatedPage
exit="exit" ref={ref}
initial="initial" animate="animate"
transition={{ duration: 0.2, type: 'tween' }} exit="exit"
variants={variants} initial="initial"
> transition={{ duration: 0.2, type: 'tween' }}
{children} variants={variants}
</StyledAnimatedPage> >
); {children}
}; </StyledAnimatedPage>
);
},
);