From abf4b33a22b665686811feb20cdc5473c3590ee0 Mon Sep 17 00:00:00 2001 From: mukeshs Date: Wed, 29 Oct 2025 10:07:18 +0530 Subject: [PATCH] Further updates on 29-10-25 --- src/components/about/process.tsx | 414 +++++++++++++++++++++---------- 1 file changed, 287 insertions(+), 127 deletions(-) diff --git a/src/components/about/process.tsx b/src/components/about/process.tsx index f1051bd..8524519 100644 --- a/src/components/about/process.tsx +++ b/src/components/about/process.tsx @@ -1,8 +1,44 @@ 'use client' -import React, { useState } from "react"; +import React, { useState, useEffect, useRef } from "react"; export default function Process() { const [activeStep, setActiveStep] = useState(-1); + const [scrollProgress, setScrollProgress] = useState(0); + const containerRef = useRef(null); + const timelineRef = useRef(null); + + useEffect(() => { + const handleScroll = () => { + if (!containerRef.current || !timelineRef.current) return; + + const container = containerRef.current; + const timeline = timelineRef.current; + const rect = container.getBoundingClientRect(); + const timelineHeight = timeline.scrollHeight - timeline.clientHeight; + + // Calculate when section enters viewport + if (rect.top <= 0 && rect.bottom >= window.innerHeight) { + // Section is sticky, scroll the timeline + const progress = Math.abs(rect.top) / (rect.height - window.innerHeight); + const clampedProgress = Math.max(0, Math.min(1, progress)); + setScrollProgress(clampedProgress); + timeline.scrollTop = clampedProgress * timelineHeight; + } else if (rect.top > 0) { + // Before sticky + setScrollProgress(0); + timeline.scrollTop = 0; + } else { + // After sticky + setScrollProgress(1); + timeline.scrollTop = timelineHeight; + } + }; + + window.addEventListener('scroll', handleScroll); + handleScroll(); // Initial check + + return () => window.removeEventListener('scroll', handleScroll); + }, []); const CalendarIcon = ( -
-
- {/* Left Column */} -
-
-
- Milestones +
+
+
+
+ {/* Left Column */} +
+
+
+ Milestones +
+

+ Our Journey in Trauma Care +

+

+ From the formation of Trauma Services in 2017 to establishing a Level-1 Trauma Facility and comprehensive trauma care programs, we continue to expand our emergency care services with dedication and excellence. +

-

- Our Journey in Trauma Care -

-

- From the inauguration of our Department of Trauma Surgery to - establishing a Level-1 Trauma Facility, we continue to expand our - emergency care services with dedication and excellence. -

-
- {/* Right Column - Steps */} -
- {steps.map((step, index) => ( -
setActiveStep(index)} - onMouseLeave={() => setActiveStep(-1)} + {/* Right Column - Auto-scrolling Timeline */} +
+
- {/* Connecting Line */} - {index !== 0 && ( -
-
= index || - (activeStep === -1 && index === 0) - ? "h-full scale-y-100" - : "h-0 scale-y-0" - }`} - style={{ backgroundColor: "#012068" }} - /> -
- )} - - {/* Step Content */} -
- {/* Number Circle */} + {steps.map((step, index) => (
setActiveStep(index)} + onMouseLeave={() => setActiveStep(-1)} > - {step.number} -
+ {/* Connecting Line */} + {index !== 0 && ( +
+
= index || + (activeStep === -1 && index === 0) + ? "h-full scale-y-100" + : "h-0 scale-y-0" + }`} + style={{ backgroundColor: "#012068" }} + /> +
+ )} - {/* Step Card */} -
- {/* Icon */} -
+ {/* Number Circle */} +
- {step.icon} -
+ ? "scale-110 shadow-lg ring-4" + : "scale-100 hover:scale-105" + }`} + style={{ + backgroundColor: + activeStep === index || + (activeStep === -1 && index === 0) + ? "#012068" + : "#333", + "--tw-ring-color": + activeStep === index || + (activeStep === -1 && index === 0) + ? "#012068" + "33" + : "transparent", + } as React.CSSProperties} + > + {step.number} +
- {/* Text */} -

- {step.title} -

-

- {step.description} -

+ {/* Step Card */} +
+ {/* Icon */} +
+ {step.icon} +
+ + {/* Text */} +

+ {step.title} +

+

+ {step.description} +

+
+
-
+ ))}
- ))} +
); -} +} \ No newline at end of file