From 91df81439e5bf5c06ff561816024621ffe2af146 Mon Sep 17 00:00:00 2001 From: Philipp Melab Date: Thu, 14 Sep 2023 13:53:30 +0000 Subject: [PATCH] feat: example page transition --- .../components/Molecules/PageTransition.tsx | 22 +++++++++++ .../ui/src/components/Routes/ContentHub.tsx | 7 +++- packages/ui/src/components/Routes/Frame.tsx | 7 +++- packages/ui/src/components/Routes/Page.tsx | 39 ++++++++++--------- 4 files changed, 54 insertions(+), 21 deletions(-) create mode 100644 packages/ui/src/components/Molecules/PageTransition.tsx diff --git a/packages/ui/src/components/Molecules/PageTransition.tsx b/packages/ui/src/components/Molecules/PageTransition.tsx new file mode 100644 index 000000000..4cc88d93a --- /dev/null +++ b/packages/ui/src/components/Molecules/PageTransition.tsx @@ -0,0 +1,22 @@ +import React from 'react'; +import { motion } from 'framer-motion'; +import { PropsWithChildren } from 'react'; + +export function PageTransition({ children }: PropsWithChildren) { + return ( + + {children} + + ); +} diff --git a/packages/ui/src/components/Routes/ContentHub.tsx b/packages/ui/src/components/Routes/ContentHub.tsx index dfda46723..3f0ec2704 100644 --- a/packages/ui/src/components/Routes/ContentHub.tsx +++ b/packages/ui/src/components/Routes/ContentHub.tsx @@ -1,7 +1,12 @@ import React from 'react'; +import { PageTransition } from '../Molecules/PageTransition'; import { ContentHub as ContentHubOrganism } from '../Organisms/ContentHub'; export function ContentHub(props: { pageSize: number }) { - return ; + return ( + + + + ); } diff --git a/packages/ui/src/components/Routes/Frame.tsx b/packages/ui/src/components/Routes/Frame.tsx index 1e9727df3..8d7ad5a85 100644 --- a/packages/ui/src/components/Routes/Frame.tsx +++ b/packages/ui/src/components/Routes/Frame.tsx @@ -1,3 +1,4 @@ +import { AnimatePresence } from 'framer-motion'; import React, { ComponentProps, PropsWithChildren, useEffect } from 'react'; import { Messages, readMessages } from '../Molecules/Messages'; @@ -18,8 +19,10 @@ export function Frame(
- - {props.children} + + + {props.children} +
diff --git a/packages/ui/src/components/Routes/Page.tsx b/packages/ui/src/components/Routes/Page.tsx index 331905ebe..89959af5e 100644 --- a/packages/ui/src/components/Routes/Page.tsx +++ b/packages/ui/src/components/Routes/Page.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { isTruthy } from '../../utils/isTruthy'; import { UnreachableCaseError } from '../../utils/unreachable-case-error'; +import { PageTransition } from '../Molecules/PageTransition'; import { BlockForm } from '../Organisms/PageContent/BlockForm'; import { BlockMarkup } from '../Organisms/PageContent/BlockMarkup'; import { BlockMedia } from '../Organisms/PageContent/BlockMedia'; @@ -10,26 +11,28 @@ import { PageHero } from '../Organisms/PageHero'; export function Page(props: { page: PageFragment }) { return ( -
- {props.page.hero ? : null} -
-
-
- {props.page?.content?.filter(isTruthy).map((block, index) => { - switch (block.__typename) { - case 'BlockMedia': - return ; - case 'BlockMarkup': - return ; - case 'BlockForm': - return ; - default: - throw new UnreachableCaseError(block); - } - })} + +
+ {props.page.hero ? : null} +
+
+
+ {props.page?.content?.filter(isTruthy).map((block, index) => { + switch (block.__typename) { + case 'BlockMedia': + return ; + case 'BlockMarkup': + return ; + case 'BlockForm': + return ; + default: + throw new UnreachableCaseError(block); + } + })} +
-
+ ); }