Skip to content

Commit 56b324c

Browse files
Merge pull request #682 from madhavansingh/fix/apply-page-icon-shift
fix: resolve icon shifting issue while scrolling on Apply page
2 parents 69ce9e3 + fe18e39 commit 56b324c

2 files changed

Lines changed: 50 additions & 21 deletions

File tree

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,49 @@
1-
'use client'
2-
3-
import clsx from "clsx"
1+
"use client"
42
import { motion } from "framer-motion"
53

6-
export function TimelineElement({ title, description, button, time, link, classCondition }) {
4+
export function TimelineElement({ title, description, time }) {
75
return (
8-
<motion.li
9-
initial={{ opacity: 0, x: -30 }}
10-
whileInView={{ opacity: 1, x: 0 }}
11-
viewport={{ once: true }}
12-
transition={{ duration: 0.5 }}
13-
className="mb-10 ml-6"
14-
>
15-
<span className="absolute flex items-center justify-center w-6 h-6 bg-green-100 rounded-full -left-3 ring-8 ring-white dark:ring-zinc-900 dark:bg-yellow-900 scale-150">
16-
<svg aria-hidden="true" className="w-3 h-3 text-green-800 dark:text-yellow-300" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
17-
<path fillRule="evenodd" d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z" clipRule="evenodd"></path>
6+
<li className="mb-10 ml-6">
7+
<motion.span
8+
initial={{ opacity: 0, x: 50 }}
9+
whileInView={{ opacity: 1, x: 0 }}
10+
viewport={{ once: true, amount: 0.5 }}
11+
transition={{ type: "spring", stiffness: 50, damping: 20 }}
12+
className="absolute flex items-center justify-center w-6 h-6 bg-green-100 rounded-full -left-3 ring-8 ring-white dark:ring-zinc-900 dark:bg-yellow-900 scale-150"
13+
>
14+
<svg
15+
aria-hidden="true"
16+
className="w-3 h-3 text-green-800 dark:text-yellow-300"
17+
fill="currentColor"
18+
viewBox="0 0 20 20"
19+
xmlns="http://www.w3.org/2000/svg"
20+
>
21+
<path
22+
fillRule="evenodd"
23+
d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"
24+
clipRule="evenodd"
25+
/>
1826
</svg>
19-
</span>
20-
<h3 className="flex font-mono tracking-tighter items-center mb-1 text-xl font-bold text-gray-900 dark:text-white ml-2">{title}</h3>
21-
<time className="block mb-2 font-mono text-sm font-normal leading-none text-gray-400 dark:text-gray-500">{time}</time>
22-
<p className="mb-4 font-mono tracking-tight text-base font-normal text-gray-500 dark:text-gray-400 ml-2">{description}</p>
23-
</motion.li>
27+
</motion.span>
28+
29+
<motion.div
30+
initial={{ opacity: 0, x: 50 }}
31+
whileInView={{ opacity: 1, x: 0 }}
32+
viewport={{ once: true, amount: 0.5 }}
33+
transition={{ type: "spring", stiffness: 50, damping: 20, delay: 0.1 }}
34+
>
35+
<h3 className="flex font-mono tracking-tighter items-center mb-1 text-xl font-bold text-gray-900 dark:text-white ml-2">
36+
{title}
37+
</h3>
38+
39+
<time className="block mb-2 font-mono text-sm font-normal leading-none text-gray-400 dark:text-gray-500">
40+
{time}
41+
</time>
42+
43+
<p className="mb-4 font-mono tracking-tight text-base font-normal text-gray-500 dark:text-gray-400 ml-2">
44+
{description}
45+
</p>
46+
</motion.div>
47+
</li>
2448
)
25-
}
49+
}

src/components/apply/ApplyHeader.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
'use client'
22

33
import { Container } from '@/components/shared/Container'
4-
import { motion } from 'framer-motion'
4+
import { motion, useScroll, useTransform, useSpring } from 'framer-motion'
55
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
66
import { faDiscord, faGithub} from '@fortawesome/free-brands-svg-icons'
77
import { faLightbulb, faComments, faPaperPlane } from '@fortawesome/free-solid-svg-icons'
88

99
export function ApplyHeader({ children }) {
10+
const { scrollY } = useScroll();
11+
const smoothScroll = useSpring(scrollY, { stiffness: 100, damping: 30, restDelta: 0.001 });
12+
const translateX = useTransform(smoothScroll, [0, 800], [0, -30]);
13+
1014
const steps = [
1115
{ icon: faDiscord, label: "Join Discord" },
1216
{ icon: faGithub, label: "Start Contributing" },
@@ -34,6 +38,7 @@ export function ApplyHeader({ children }) {
3438

3539
{/* New Horizontal Timeline Steps */}
3640
<motion.div
41+
style={{ x: translateX }}
3742
initial="hidden"
3843
whileInView="visible"
3944
viewport={{ once: true }}

0 commit comments

Comments
 (0)