Skip to content

Commit 8a54017

Browse files
committed
✨ Update HomePage component: enhance greeting logic, modify menu items, and improve layout styling
1 parent cd55d59 commit 8a54017

1 file changed

Lines changed: 53 additions & 21 deletions

File tree

app/page.tsx

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,54 @@ import { useRouter } from 'next/navigation';
99
import { LoaderIcon } from "lucide-react";
1010

1111
const menuItems = [
12+
// {
13+
// name: 'Windows',
14+
// href: '#',
15+
// icon: WindowsIcon,
16+
// className: 'max-sm:size-4 size-7',
17+
// },
1218
{
13-
name: 'Windows',
14-
href: '#',
15-
icon: WindowsIcon,
16-
className: 'max-sm:size-4 size-7',
19+
name: 'Sophat LEAT',
20+
href: 'https://google.com/search?q=sophat+leat',
21+
icon: SearchIcon,
22+
className: 'text-gray-500 size-4',
1723
},
1824
{
19-
name: 'Search',
20-
href: '#',
25+
name: 'LEAT Sophat',
26+
href: 'https://google.com/search?q=leat+sophat',
2127
icon: SearchIcon,
22-
className: 'max-sm:size-4 text-gray-500 size-6',
28+
className: 'text-gray-500 size-4',
2329
},
2430
{
25-
name: 'GitHub',
26-
href: '#',
27-
icon: GithubIcon,
28-
className: 'max-sm:size-4 text-gray-600 size-7',
31+
name: 'pphatdev',
32+
href: 'https://google.com/search?q=pphatdev',
33+
icon: SearchIcon,
34+
className: 'text-gray-500 size-4',
35+
},
36+
{
37+
name: 'sophatleat',
38+
href: 'https://google.com/search?q=sophatleat',
39+
icon: SearchIcon,
40+
className: 'text-gray-500 size-4',
2941
},
3042
{
31-
name: 'VS Code',
32-
href: '#',
33-
icon: VisualStudioCodeIcon,
34-
className: 'max-sm:size-4 text-blue-500 size-7 mt-0.5',
43+
name: 'leatsophat',
44+
href: 'https://google.com/search?q=leatsophat',
45+
icon: SearchIcon,
46+
className: 'text-gray-500 size-4',
3547
},
48+
// {
49+
// name: 'GitHub',
50+
// href: '#',
51+
// icon: GithubIcon,
52+
// className: 'max-sm:size-4 text-gray-600 size-7',
53+
// },
54+
// {
55+
// name: 'VS Code',
56+
// href: '#',
57+
// icon: VisualStudioCodeIcon,
58+
// className: 'max-sm:size-4 text-blue-500 size-7 mt-0.5',
59+
// },
3660
];
3761

3862

@@ -43,6 +67,14 @@ export default function HomePage() {
4367
const [pin, setPin] = useState('1234');
4468
const router = useRouter();
4569

70+
const greetings = () => {
71+
const hour = currentTime.getHours();
72+
if (hour < 12) return 'Good Morning';
73+
if (hour < 18) return 'Good Afternoon';
74+
return 'Good Evening';
75+
}
76+
77+
4678
useEffect(() => {
4779
const timer = setInterval(() => {
4880
setCurrentTime(new Date());
@@ -79,11 +111,11 @@ export default function HomePage() {
79111

80112

81113
return (
82-
<main className="min-h-screen font-sans relative bg-linear-to-b from-amber-50 to-amber-200 text-center">
114+
<main className="min-h-screen font-sans relative bg-linear-to-b from-amber-50 to-amber-100 text-center">
83115
<div className="flex flex-col gap-3 items-center justify-center min-h-screen">
84116

85117
<div className="flex justify-center max-sm:mt-5 flex-col mb-5">
86-
<p className="leading-4 text-sm mb-2">Welcome back</p>
118+
<p className="leading-4 text-sm mb-2">{greetings()}, Welcome back</p>
87119
<time dateTime="" className="max-sm:text-3xl text-6xl font-bold"> {formatTime(currentTime)}</time>
88120
<p className="max-sm:text-lg text-foreground/70 text-2xl mt-1">{formatDate(currentTime)}</p>
89121
</div>
@@ -99,7 +131,7 @@ export default function HomePage() {
99131
</div>
100132

101133
<div className="flex w-full max-w-60 mx-auto justify-center max-sm:gap-1 gap-2 shadow-2xl">
102-
<input type="password" className="text-base leading-5 font-black tracking-[3px] bg-background w-full px-3 py-1.5 rounded-lg rounded-r-sm outline-0 ring-2 ring-background/50 focus-within:ring-amber-400" placeholder="PIN" value={pin} onChange={(e) => setPin(e.target.value)} />
134+
<input type="password" className="text-base leading-5 font-black tracking-[3px] bg-background w-full px-3 py-1.5 rounded-lg rounded-r-sm outline-0 ring-2 ring-amber-200/70 focus-within:ring-amber-400" placeholder="PIN" value={pin} onChange={(e) => setPin(e.target.value)} />
103135
<button type="submit" disabled={loggingIn} onClick={loginHandler} className="text-base transition-all duration-300 shrink-0 bg-amber-600 disabled:opacity-50 cursor-pointer text-white leading-5 font-medium px-3 py-1.5 rounded-lg rounded-l-sm ring-2 ring-amber-300 focus-within:ring-amber-400">
104136
{
105137
loggingIn
@@ -112,9 +144,9 @@ export default function HomePage() {
112144
</div>
113145
</div>
114146

115-
116-
<footer className="pb-5 mt-10 w-full px-4 mb-5">
117-
<ul className="flex w-full max-w-3xl overflow-x-auto mx-auto justify-center py-1.5 gap-8">
147+
<footer className="pb-5 mt-10 w-full px-4 mb-5 flex gap-2 flex-col items-center justify-center">
148+
<div className="h-0.5 w-full max-w-xs mx-auto mt-5 bg-linear-to-r from-transparent via-amber-300 to-transparent"></div>
149+
<ul className="flex flex-wrap w-full max-w-3xl overflow-x-auto pb-5 mx-auto justify-center py-1.5 gap-x-8">
118150
{menuItems.map((item) => (
119151
<li key={item.name} className="flex items-center gap-0.5 justify-center">
120152
<a href={item.href} className="relative flex flex-col items-center justify-center size-9 rounded-lg hover:bg-white hover:shadow-lg duration-200 shadow-black/10 transition-colors">

0 commit comments

Comments
 (0)