+
+ {/* WHO WE ARE Section */}
+
+
+
WHO WE ARE
+
+ We share a passion for data, technology, and problem-solving.
+
+
+ We are here to expand the horizons of data science as a community
+ together.
+
+
+
-
-
-
-
-
-
-
WHAT WE DO
-
- Build technical skills, network, and gain practical experience in data science.
-
-
We are here to expand the horizons of data science as a community together
+ {/* First Image */}
+
+ {/* Second Image */}
+
+ {/* WHAT WE DO Section */}
+
+
+
WHAT WE DO
+
+ Build technical skills, network, and gain practical experience in
+ data science.
+
+
+ We are here to expand the horizons of data science as a community
+ together.
+
+
+
-
);
diff --git a/src/Pages/Home/Stats.tsx b/src/Pages/Home/Stats.tsx
index a190ac4..1b5ece1 100644
--- a/src/Pages/Home/Stats.tsx
+++ b/src/Pages/Home/Stats.tsx
@@ -11,65 +11,85 @@ const Stats = () => {
const maxNumbers = [500, 78, 35, 28];
- const [statsData, setStatsData] = useState([0, 0, 0, 0]);
- const sectionRef = useRef(null);
+ const [statsData, setStatsData] = useState
([0, 0, 0, 0]);
+ const [animated, setAnimated] = useState([
+ false,
+ false,
+ false,
+ false,
+ ]);
+ const itemRefs = useRef<(HTMLDivElement | null)[]>([]);
- const startCounting = () => {
+ const startCounting = (index: number): void => {
const interval = setInterval(() => {
- setStatsData((prev) =>
- prev.map((num, index) =>
- Math.min(num + maxNumbers[index] / 15, maxNumbers[index])
- )
- );
+ setStatsData((prev) => {
+ const newStats = [...prev];
+ newStats[index] = Math.min(
+ newStats[index] + maxNumbers[index] / 15,
+ maxNumbers[index]
+ );
+ return newStats;
+ });
}, 50);
return () => clearInterval(interval);
};
useEffect(() => {
- const observer = new IntersectionObserver(
- ([entry]) => {
- console.log("Intersection Observer callback triggered"); // Log every time the observer is triggered
- console.log("Is intersecting:", entry.isIntersecting); // Log whether the section is intersecting or not
- console.log("Intersection Ratio:", entry.intersectionRatio); // Log how much of the section is visible
+ const observers = itemRefs.current.map(
+ (ref, index): IntersectionObserver | null => {
+ if (!ref) return null;
- if (entry.isIntersecting) {
- console.log("Section is in view. Starting count-up!"); // Log when the count-up is about to start
- startCounting();
- }
- },
- { threshold: 0.99 } // % of the section that must be visible
- );
+ const observer = new IntersectionObserver(
+ ([entry]) => {
+ if (entry.isIntersecting && !animated[index]) {
+ setAnimated((prev) => {
+ const updated = [...prev];
+ updated[index] = true;
+ return updated;
+ });
+ startCounting(index);
+ }
+ },
+ { threshold: 0.4 }
+ );
- if (sectionRef.current) {
- console.log("Observing section:", sectionRef.current); // Log when the observer starts observing the section
- observer.observe(sectionRef.current);
- }
+ observer.observe(ref);
+ return observer;
+ }
+ );
return () => {
- if (sectionRef.current) {
- console.log("Unobserving section:", sectionRef.current); // Log when the observer stops observing the section
- observer.unobserve(sectionRef.current);
- }
+ observers.forEach((observer, index) => {
+ if (observer && itemRefs.current[index]) {
+ observer.unobserve(itemRefs.current[index]!);
+ }
+ });
};
- }, []);
+ }, [animated]);
return (
-
+
Get Involved
-
-
+
+
{statsData.map((stat, index) => (
-
+
+ (itemRefs.current[index] = el)
+ }
+ >
{
ease: "easeOut",
}}
viewport={{ once: true }}
- className="number text-7xl font-bold w-20 text-right text-white hero-text-shadow mr-20"
+ className="number text-[4.5vw] font-bold w-[2vw] text-right text-white hero-text-shadow mr-[8vw]"
>
{Math.round(stat) +
(Math.round(stat) === maxNumbers[index] ? "+" : "")}
@@ -93,7 +113,7 @@ const Stats = () => {
delay: index * 0.125,
ease: "easeOut",
}}
- className="text-white text-2xl ml-20"
+ className="text-white text-[1.8vw] ml-[8vw]"
viewport={{ once: true }}
>
{descriptions[index]}