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,9 +22,11 @@ const variants = {
initial: { opacity: 0 }, initial: { opacity: 0 },
}; };
export const AnimatedPage = ({ children }: AnimatedPageProps) => { export const AnimatedPage = forwardRef(
({ children }: AnimatedPageProps, ref: Ref<HTMLDivElement>) => {
return ( return (
<StyledAnimatedPage <StyledAnimatedPage
ref={ref}
animate="animate" animate="animate"
exit="exit" exit="exit"
initial="initial" initial="initial"
@@ -29,4 +36,5 @@ export const AnimatedPage = ({ children }: AnimatedPageProps) => {
{children} {children}
</StyledAnimatedPage> </StyledAnimatedPage>
); );
}; },
);