Skip to content

Commit a6d072d

Browse files
committed
Start work on animating add to cart
1 parent fc0cadb commit a6d072d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// CircleCI doesn't like import { motion } from "framer-motion" here, so we use require
2+
const { motion } = require('framer-motion');
3+
4+
/**
5+
* Fade up content animation
6+
* @function FadeUp
7+
* @param {ReactNode} children - Children content to render
8+
* @param {string} cssClass - CSS classes to apply to component
9+
* @param {number} delay - Time to wait before starting animation
10+
* @returns {JSX.Element} - Rendered component
11+
*/
12+
13+
const FadeUp = ({ children, cssClass, delay }) => {
14+
const fadeUpVariants = {
15+
initial: { opacity: 0, y: 20 },
16+
animate: {
17+
y: 0,
18+
opacity: 1,
19+
transition: { delay, type: 'spring', duration: 0.5, stiffness: 110 },
20+
},
21+
};
22+
return (
23+
<motion.div
24+
className={cssClass}
25+
variants={fadeUpVariants}
26+
initial="initial"
27+
animate="animate"
28+
data-testid="fadeup"
29+
>
30+
{children}
31+
</motion.div>
32+
);
33+
};
34+
35+
export default FadeUp;

0 commit comments

Comments
 (0)