diff --git a/src/App.jsx b/src/App.jsx index 99d8d90b1..2619abefe 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -15,20 +15,28 @@ import VerticalTimeline from './Components/Timeline'; import Carousel from './Components/Carousel'; import Hero from './Components/Hero'; import Footer from "./Components/Footer" +import CountdownTimer from './Components/CountDownTimer'; const Homepage = () => { return (
+ - {/* Text Section between Hero and Carousel */} + + {/* Text Section between Hero and Carousel */}
+

Welcome to Project X

We are an exclusive club at Veermata Jijabai Technological Institute, Mumbai. We provide a collaborative environment for students to learn, grow, and build projects together under mentorship. Explore our achievements, past projects, and upcoming events!

+ {/* Countdown Timer */} + + + {/* Carousel Section */}
@@ -38,7 +46,6 @@ const Homepage = () => { - function App() { return (
diff --git a/src/Components/CountDownTimer.jsx b/src/Components/CountDownTimer.jsx new file mode 100644 index 000000000..899dc29dd --- /dev/null +++ b/src/Components/CountDownTimer.jsx @@ -0,0 +1,162 @@ +import React, { useState, useEffect } from 'react'; + +const CountdownTimer = () => { + const targetDate = new Date('2025-01-25T23:59:59').getTime(); + const [timeLeft, setTimeLeft] = useState(calculateTimeLeft()); + + function calculateTimeLeft() { + const now = new Date().getTime(); + const difference = targetDate - now; + + if (difference > 0) { + return { + days: Math.floor(difference / (1000 * 60 * 60 * 24)), + hours: Math.floor((difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)), + minutes: Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60)), + seconds: Math.floor((difference % (1000 * 60)) / 1000), + }; + } + + return { days: 0, hours: 0, minutes: 0, seconds: 0 }; + } + + useEffect(() => { + const timer = setInterval(() => { + setTimeLeft(calculateTimeLeft()); + }, 1000); + + return () => clearInterval(timer); + }, []); + + const calculateProgress = (value, max) => { + return (value / max) * 100; + }; + + return ( +
+
+

Event Ends In

{/* Larger text */} +
{/* Increased spacing */} + {/* Days */} +
+
{/* Larger circle */} + + + + + {/* Larger text */} + {timeLeft.days} + +
+ Days {/* Larger label */} +
+ {/* Hours */} +
+
{/* Larger circle */} + + + + + {/* Larger text */} + {timeLeft.hours} + +
+ Hours {/* Larger label */} +
+ {/* Minutes */} +
+
{/* Larger circle */} + + + + + {/* Larger text */} + {timeLeft.minutes} + +
+ Minutes {/* Larger label */} +
+ {/* Seconds */} +
+
{/* Larger circle */} + + + + + {/* Larger text */} + {timeLeft.seconds} + +
+ Seconds {/* Larger label */} +
+
+
+
+ ); +}; + +export default CountdownTimer; \ No newline at end of file