Add page transitions

This commit is contained in:
Timothy Pidashev
2024-03-19 09:49:04 -07:00
parent b37f35350b
commit b04cd10453
4 changed files with 26 additions and 1 deletions

View File

@@ -6,6 +6,6 @@ import { HeroSection1, HeroSection2, HeroSection3 } from "@/components/hero";
// Exports // Exports
export default function Index() { export default function Index() {
return ( return (
<div></div> <div>Home</div>
); );
} }

View File

@@ -6,6 +6,7 @@
export default function Projects() { export default function Projects() {
return ( return (
<div> <div>
projects
</div> </div>
); );
} }

View File

@@ -0,0 +1,5 @@
import PageTransition from "@/components/transitions";
export default function rootTemplate({ children }) {
return <PageTransition>{children}</PageTransition>;
}

View File

@@ -0,0 +1,19 @@
"use client"
import { motion } from "framer-motion";
const PageTransition = ({ children }) => (
<motion.div
initial={{ x: 300, opacity: 0 }}
animate={{ x: 0, opacity: 1 }}
exit={{ x: 300, opacity: 0 }}
transition={{
type: "spring",
stiffness: 260,
damping: 20,
}}
>
{children}
</motion.div>
);
export default PageTransition;