summaryrefslogtreecommitdiff
path: root/src/components/Layout.js
diff options
context:
space:
mode:
authorRafi Zadanly <rafizadanly@gmail.com>2022-11-19 13:55:00 +0700
committerRafi Zadanly <rafizadanly@gmail.com>2022-11-19 13:55:00 +0700
commit40bab7be1e0025c7c089e1eac17451ef155a989a (patch)
tree5a87f4fd87f3c6bc0823e58614dd93ca6c97d2c8 /src/components/Layout.js
parent679e565b4594bd172f2576926567a740760ff55e (diff)
Add page transition
Diffstat (limited to 'src/components/Layout.js')
-rw-r--r--src/components/Layout.js26
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