diff options
| author | Rafi Zadanly <rafizadanly@gmail.com> | 2022-11-19 13:55:00 +0700 |
|---|---|---|
| committer | Rafi Zadanly <rafizadanly@gmail.com> | 2022-11-19 13:55:00 +0700 |
| commit | 40bab7be1e0025c7c089e1eac17451ef155a989a (patch) | |
| tree | 5a87f4fd87f3c6bc0823e58614dd93ca6c97d2c8 /src/components | |
| parent | 679e565b4594bd172f2576926567a740760ff55e (diff) | |
Add page transition
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Layout.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/components/Layout.js b/src/components/Layout.js new file mode 100644 index 00000000..eb4e8923 --- /dev/null +++ b/src/components/Layout.js @@ -0,0 +1,26 @@ +import { motion } from 'framer-motion'; + +export default function Layout({ children, pageProps }) { + const variants = { + hidden: { opacity: 0, x: -75, y: 0 }, + enter: { opacity: 1, x: 0, y: 0 }, + exit: { opacity: 0, x: 0, y: -50 }, + }; + + const transition = { + ease: 'linear', + duration: 0.2 + }; + + return children && ( + <motion.main + initial={{ opacity: 0, x: -75, y: 0 }} + animate={{ opacity: 1, x: 0, y: 0 }} + exit={{ opacity: 0, x: 0, y: -50 }} + transition={transition} + {...pageProps} + > + {children} + </motion.main> + ); +}
\ No newline at end of file |
