Skip to content

Commit 9aec57d

Browse files
authored
Merge pull request #1530 from w3bdesign/develop
Replace Framer Motion
2 parents 1f328ec + d3b8efb commit 9aec57d

File tree

5 files changed

+69
-25
lines changed

5 files changed

+69
-25
lines changed

package-lock.json

Lines changed: 27 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
"@types/react": "^19.1.8",
3131
"algoliasearch": "^4.25.0",
3232
"autoprefixer": "^10.4.21",
33-
"framer-motion": "12.20.1",
3433
"graphql": "^16.11.0",
3534
"lodash": "^4.17.21",
35+
"motion": "^12.20.1",
3636
"next": "15.3.4",
3737
"nprogress": "^0.2.0",
3838
"postcss": "^8.5.6",

src/components/Animations/FadeLeftToRight.component.tsx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// CircleCI doesn't like import { motion } from "framer-motion" here, so we use require
2-
const { motion } = require('framer-motion');
1+
import { motion, Transition } from 'motion/react';
32

43
import type { IAnimateStaggerWithDelayProps } from './types/Animations.types';
54

@@ -21,24 +20,28 @@ const FadeLeftToRight = ({
2120
staggerDelay,
2221
animateNotReverse,
2322
}: IAnimateStaggerWithDelayProps) => {
23+
const visibleTransition: Transition = {
24+
when: 'beforeChildren',
25+
staggerChildren: staggerDelay ? staggerDelay : 0.5,
26+
delay,
27+
ease: 'easeInOut',
28+
staggerDirection: 1,
29+
};
30+
31+
const hiddenTransition: Transition = {
32+
when: 'afterChildren',
33+
staggerChildren: staggerDelay ? staggerDelay : 0.5,
34+
staggerDirection: -1,
35+
};
36+
2437
const FadeLeftToRightVariants = {
2538
visible: {
2639
opacity: 1,
27-
transition: {
28-
when: 'beforeChildren',
29-
staggerChildren: staggerDelay ? staggerDelay : 0.5,
30-
delay,
31-
ease: 'easeInOut',
32-
staggerDirection: 1,
33-
},
40+
transition: visibleTransition,
3441
},
3542
hidden: {
3643
opacity: 0,
37-
transition: {
38-
when: 'afterChildren',
39-
staggerChildren: staggerDelay ? staggerDelay : 0.5,
40-
staggerDirection: -1,
41-
},
44+
transition: hiddenTransition,
4245
},
4346
};
4447
return (

src/components/Animations/FadeLeftToRightItem.component.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// CircleCI doesn't like import { motion } from "framer-motion" here, so we use require
2-
const { motion } = require('framer-motion');
1+
import { motion, Transition } from 'motion/react';
32

43
import type { IAnimateProps } from './types/Animations.types';
54

@@ -12,13 +11,23 @@ import type { IAnimateProps } from './types/Animations.types';
1211
*/
1312

1413
const FadeLeftToRightItem = ({ children, cssClass }: IAnimateProps) => {
15-
const FadeLeftToRightItemVariants = {
16-
visible: { opacity: 1, x: 0 },
14+
const transition: Transition = {
15+
type: 'spring',
16+
duration: 0.5,
17+
stiffness: 110,
18+
};
19+
20+
const fadeLeftToRightItemVariants = {
21+
visible: {
22+
opacity: 1,
23+
x: 0,
24+
transition,
25+
},
1726
hidden: { opacity: 0, x: -20 },
1827
};
1928
return (
2029
<motion.span
21-
variants={FadeLeftToRightItemVariants}
30+
variants={fadeLeftToRightItemVariants}
2231
className={cssClass}
2332
data-testid="fadelefttorightitem"
2433
>

src/components/Animations/FadeUp.component.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// CircleCI doesn't like import { motion } from "framer-motion" here, so we use require
2-
const { motion } = require('framer-motion');
1+
import { motion, Transition } from 'motion/react';
32

43
import type { IAnimateWithDelayProps } from './types/Animations.types';
54

@@ -13,14 +12,22 @@ import type { IAnimateWithDelayProps } from './types/Animations.types';
1312
*/
1413

1514
const FadeUp = ({ children, cssClass, delay }: IAnimateWithDelayProps) => {
15+
const transition: Transition = {
16+
delay,
17+
type: 'spring',
18+
duration: 0.5,
19+
stiffness: 110,
20+
};
21+
1622
const fadeUpVariants = {
1723
initial: { opacity: 0, y: 20 },
1824
animate: {
1925
y: 0,
2026
opacity: 1,
21-
transition: { delay, type: 'spring', duration: 0.5, stiffness: 110 },
27+
transition,
2228
},
2329
};
30+
2431
return (
2532
<motion.div
2633
className={cssClass}

0 commit comments

Comments
 (0)