Skip to content

Commit 8a20b7b

Browse files
committed
refactor hero animation into shared component
1 parent b086c55 commit 8a20b7b

3 files changed

Lines changed: 34 additions & 50 deletions

File tree

frontend/src/components/HomeComponents/Hero/Hero.tsx

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CopyButton } from './CopyButton';
33
import { ToastNotification } from './ToastNotification';
44
import { useState } from 'react';
55
import { Eye, EyeOff } from 'lucide-react';
6-
import { motion } from 'framer-motion';
6+
import { AnimatedHeroGlow } from '@/components/utils/AnimatedHeroGlow';
77

88
export const Hero = (props: Props) => {
99
const [showUuid, setShowUuid] = useState(true);
@@ -95,30 +95,7 @@ export const Hero = (props: Props) => {
9595
</div>
9696
</div>
9797

98-
<motion.div
99-
aria-hidden="true"
100-
className="pointer-events-none absolute rounded-[24px] rotate-[35deg]"
101-
style={{
102-
top: 200,
103-
right: 460,
104-
width: 260,
105-
height: 400,
106-
filter: 'blur(150px)',
107-
}}
108-
animate={{
109-
right: [460, 160],
110-
backgroundColor: [
111-
'hsla(330, 100%, 50%, 0.2)',
112-
'hsla(240, 100%, 50%, 0.8)',
113-
],
114-
}}
115-
transition={{
116-
duration: 4,
117-
repeat: Infinity,
118-
repeatType: 'reverse',
119-
ease: 'linear',
120-
}}
121-
/>
98+
<AnimatedHeroGlow />
12299

123100
<ToastNotification />
124101
</section>

frontend/src/components/LandingComponents/Hero/Hero.tsx

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Button } from '../../ui/button';
33
import { buttonVariants } from '../../ui/button';
44
import { HeroCards } from './HeroCards';
55
import { GitHubLogoIcon } from '@radix-ui/react-icons';
6-
import { motion } from 'framer-motion';
6+
import { AnimatedHeroGlow } from '@/components/utils/AnimatedHeroGlow';
77

88
export const Hero = () => {
99
return (
@@ -52,30 +52,7 @@ export const Hero = () => {
5252
<HeroCards />
5353
</div>
5454

55-
<motion.div
56-
aria-hidden="true"
57-
className="pointer-events-none absolute rounded-[24px] rotate-[35deg]"
58-
style={{
59-
top: 200,
60-
right: 460,
61-
width: 260,
62-
height: 400,
63-
filter: 'blur(150px)',
64-
}}
65-
animate={{
66-
right: [460, 160],
67-
backgroundColor: [
68-
'hsla(330, 100%, 50%, 0.2)',
69-
'hsla(240, 100%, 50%, 0.8)',
70-
],
71-
}}
72-
transition={{
73-
duration: 4,
74-
repeat: Infinity,
75-
repeatType: 'reverse',
76-
ease: 'linear',
77-
}}
78-
/>
55+
<AnimatedHeroGlow />
7956
</section>
8057
);
8158
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { motion } from 'framer-motion';
2+
3+
export const AnimatedHeroGlow = () => {
4+
return (
5+
<motion.div
6+
aria-hidden="true"
7+
className="pointer-events-none absolute rounded-[24px] rotate-[35deg]"
8+
style={{
9+
top: 200,
10+
right: 460,
11+
width: 260,
12+
height: 400,
13+
filter: 'blur(150px)',
14+
}}
15+
animate={{
16+
right: [460, 160],
17+
backgroundColor: [
18+
'hsla(330, 100%, 50%, 0.2)',
19+
'hsla(240, 100%, 50%, 0.8)',
20+
],
21+
}}
22+
transition={{
23+
duration: 4,
24+
repeat: Infinity,
25+
repeatType: 'reverse',
26+
ease: 'linear',
27+
}}
28+
/>
29+
);
30+
};

0 commit comments

Comments
 (0)