Skip to content

Commit 31b8061

Browse files
Bug fixes
1 parent a0169fa commit 31b8061

1 file changed

Lines changed: 34 additions & 7 deletions

File tree

src/components/Welcome.tsx

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React, { useState, useEffect } from "react";
1+
import { useState, useEffect } from "react";
22
import { motion } from "framer-motion";
33

44
function Welcome() {
55
const [greeting, setGreeting] = useState("");
66
const [currentTime, setCurrentTime] = useState("");
7+
const [effectTime, setEffectTime] = useState(false);
78

89
useEffect(() => {
910
const updateGreeting = () => {
@@ -21,7 +22,14 @@ function Welcome() {
2122

2223
const updateTime = () => {
2324
const now = new Date();
24-
setCurrentTime(now.toLocaleTimeString());
25+
const timeString = now.toLocaleTimeString();
26+
setCurrentTime(timeString);
27+
28+
// Check if the current time matches the special effect time
29+
if (timeString === "8:41:58 PM") {
30+
setEffectTime(true);
31+
setTimeout(() => setEffectTime(false), 3000); // Reset after 3 seconds
32+
}
2533
};
2634

2735
updateGreeting();
@@ -40,11 +48,20 @@ function Welcome() {
4048
{/* Time and Greeting */}
4149
<motion.div
4250
initial={{ opacity: 0, y: -20 }}
43-
animate={{ opacity: 1, y: 0 }}
51+
animate={{
52+
opacity: 1,
53+
y: 0,
54+
scale: effectTime ? 1.2 : 1,
55+
rotate: effectTime ? 360 : 0,
56+
}}
4457
transition={{ duration: 0.6, ease: "easeOut" }}
4558
className="mb-8 text-center"
4659
>
47-
<h2 className="text-2xl font-light text-emerald-400 mb-2">
60+
<h2
61+
className={`text-2xl font-light ${
62+
effectTime ? "text-purple-400 animate-pulse" : "text-emerald-400"
63+
} mb-2`}
64+
>
4865
{currentTime}
4966
</h2>
5067
<h3 className="text-3xl font-medium text-gray-300">{greeting}!</h3>
@@ -53,14 +70,21 @@ function Welcome() {
5370
{/* Main Content */}
5471
<motion.div
5572
initial={{ opacity: 0, y: 20 }}
56-
animate={{ opacity: 1, y: 0 }}
73+
animate={{
74+
opacity: 1,
75+
y: 0,
76+
x: effectTime ? [-10, 10, -10, 0] : 0,
77+
}}
5778
transition={{ duration: 0.8, ease: "easeOut", delay: 0.2 }}
5879
className="text-center max-w-2xl bg-gradient-to-br from-gray-800/80 to-gray-900/80 p-10 rounded-3xl shadow-2xl backdrop-blur-lg border border-gray-700/50 hover:border-emerald-500/30 transition-all duration-300"
5980
>
6081
<motion.h1
6182
className="text-6xl font-bold mb-8"
6283
initial={{ scale: 0.9 }}
63-
animate={{ scale: 1 }}
84+
animate={{
85+
scale: effectTime ? [1, 1.1, 1] : 1,
86+
color: effectTime ? "#ff00ff" : undefined,
87+
}}
6488
transition={{ duration: 0.5 }}
6589
>
6690
<span className="bg-gradient-to-r from-emerald-400 via-cyan-400 to-blue-500 bg-clip-text text-transparent drop-shadow-lg">
@@ -78,7 +102,10 @@ function Welcome() {
78102
{/* Bottom Message */}
79103
<motion.div
80104
initial={{ opacity: 0 }}
81-
animate={{ opacity: 1 }}
105+
animate={{
106+
opacity: 1,
107+
y: effectTime ? [0, -10, 0] : 0,
108+
}}
82109
transition={{ duration: 0.6, delay: 0.4 }}
83110
className="absolute bottom-8 text-center space-y-2"
84111
>

0 commit comments

Comments
 (0)