Adding in framer-motion to animate in cards when in view, adding scroll to top button.

This commit is contained in:
Frank Delaguila
2022-11-11 02:23:14 -07:00
parent 86c0fa50a3
commit d9286b0c4c
4 changed files with 473 additions and 134 deletions

31
components/transition.tsx Normal file
View File

@@ -0,0 +1,31 @@
import { FC, ReactNode } from "react";
import { motion, AnimatePresence, useReducedMotion } from "framer-motion";
interface TransitionProps {
children?: ReactNode;
className?: string;
}
const Transition: FC<TransitionProps> = ({ children, className }) => {
const shouldReduceMotion = useReducedMotion();
return (
<AnimatePresence>
<motion.div
className={className}
initial={{
y: 100,
opacity: 0
}}
whileInView={{
y: 0,
opacity: 1
}}
viewport={{ once: true }}
>
{children}
</motion.div>
</AnimatePresence>
);
};
export default Transition;