Skip to content

Commit ef76d27

Browse files
author
Dhrutinandan Swain
committed
Enhance AchievementCard and Timeline components for mobile responsiveness; implement immediate visibility for cards and timeline items on mobile devices without animations.
1 parent 5360903 commit ef76d27

2 files changed

Lines changed: 32 additions & 22 deletions

File tree

src/components/AchievementCard.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ const AchievementCard = ({ title, description, year, isLeft, index }) => {
66
const [isHovered, setIsHovered] = useState(false);
77

88
useEffect(() => {
9+
// Check if it's mobile
10+
const isMobile = window.innerWidth < 768;
11+
12+
if (isMobile) {
13+
// On mobile, make cards visible immediately without animations
14+
setIsVisible(true);
15+
return;
16+
}
17+
18+
// Desktop animations
919
const observer = new IntersectionObserver(
1020
([entry]) => {
1121
if (entry.isIntersecting) {

src/components/Timeline.jsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,19 @@ const Timeline = () => {
1111
const [scrollProgress, setScrollProgress] = useState(0);
1212

1313
useEffect(() => {
14-
// Scroll progress for timeline line animation
14+
// Check if it's mobile
15+
const isMobile = window.innerWidth < 768;
16+
17+
if (isMobile) {
18+
// On mobile, make everything visible immediately without animations
19+
const allIndices = achievementsData.map((_, index) => index);
20+
setVisibleDots(new Set(allIndices));
21+
setVisibleLines(new Set(allIndices));
22+
setScrollProgress(1);
23+
return; // Exit early for mobile
24+
}
25+
26+
// Desktop scroll animations
1527
const handleScroll = () => {
1628
if (containerRef.current) {
1729
const container = containerRef.current;
@@ -47,11 +59,11 @@ const Timeline = () => {
4759
entry.target.getAttribute("data-timeline-index") || "0",
4860
);
4961

50-
// Add staggered effect
62+
// Add minimal staggered effect
5163
setTimeout(() => {
5264
setVisibleDots((prev) => new Set([...prev, index]));
5365
setVisibleLines((prev) => new Set([...prev, index]));
54-
}, index * 200);
66+
}, index * 50);
5567
}
5668
});
5769
},
@@ -147,6 +159,9 @@ const Timeline = () => {
147159
}}
148160
/>
149161

162+
{/* Mobile Timeline Line - Continuous */}
163+
<div className="md:hidden absolute left-6 top-0 w-0.5 h-full bg-gradient-to-b from-[#0B2044] to-[#51B8F2] rounded-full z-0" />
164+
150165
{/* Timeline Items */}
151166
<div className="space-y-16 md:space-y-20">
152167
{achievementsData
@@ -218,7 +233,7 @@ const Timeline = () => {
218233

219234
{/* Year Badge */}
220235
<div
221-
className={`absolute -bottom-10 left-1/2 transform -translate-x-1/2 bg-white text-[#0B2044] text-xs font-bold px-3 py-1 rounded-full shadow-md border border-gray-100 transition-all duration-500 ${
236+
className={`absolute -bottom-10 left-1/2 transform -translate-x-1/2 bg-white text-[#0B2044] text-xs font-bold px-3 py-1 rounded-full shadow-md border border-gray-100 transition-all duration-200 ${
222237
visibleDots.has(index)
223238
? "opacity-100 translate-y-0"
224239
: "opacity-0 translate-y-4"
@@ -248,24 +263,9 @@ const Timeline = () => {
248263

249264
{/* Mobile Layout */}
250265
<div className="md:hidden relative pl-8">
251-
{/* Mobile Timeline Line */}
252-
<div className="absolute left-4 top-0 w-0.5 h-full bg-gray-200 rounded-full" />
253-
<div
254-
className="absolute left-4 top-0 w-0.5 bg-gradient-to-b from-[#0B2044] to-[#51B8F2] rounded-full transition-all duration-1000"
255-
style={{
256-
height: visibleDots.has(index) ? "100%" : "0%",
257-
}}
258-
/>
259-
260-
{/* Mobile Dot */}
261-
<div className="absolute left-2 top-6 z-20">
262-
<div
263-
className={`w-4 h-4 rounded-full border-2 border-white shadow-md transition-all duration-500 ${
264-
visibleDots.has(index)
265-
? "bg-gradient-to-br from-[#0B2044] to-[#51B8F2] scale-110"
266-
: "bg-gray-300 scale-75"
267-
}`}
268-
/>
266+
{/* Mobile Dot - Static, no animation */}
267+
<div className="absolute left-6 top-6 z-20 transform -translate-x-1/2">
268+
<div className="w-4 h-4 rounded-full border-2 border-white shadow-md bg-gradient-to-br from-[#0B2044] to-[#51B8F2]" />
269269
</div>
270270

271271
{/* Mobile Card */}

0 commit comments

Comments
 (0)