-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppSidebar.tsx
More file actions
68 lines (60 loc) · 2.1 KB
/
AppSidebar.tsx
File metadata and controls
68 lines (60 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
export function AppSidebar() {
const pathname = usePathname();
const isActive = (path: string) => {
return pathname === path || pathname?.startsWith(`${path}/`);
};
const getLinkClass = (path: string) => {
if (isActive(path)) {
return "flex items-center rounded-r-full bg-[#B8CAA8] p-3 text-gray-900 group";
}
return "flex items-center rounded-lg p-3 text-white hover:bg-[#468B62] group";
};
const getTextClass = (path: string) => {
if (isActive(path)) {
return "ml-3 text-lg text-[#D16B36] font-bold";
}
return "ml-3 text-lg";
};
return (
<aside className="fixed left-0 top-16 z-40 h-[calc(100vh-4rem)] w-64 -translate-x-full transition-transform sm:translate-x-0 bg-[#559C71] text-white">
<div className="flex h-full flex-col overflow-y-auto px-3 py-4">
{/* Navigation Items */}
<ul className="space-y-4 font-medium">
{/* Home */}
<li>
<Link
href="/dashboard"
className={getLinkClass('/dashboard')}
>
<div className="flex h-10 w-10 items-center justify-center text-2xl">🏠</div>
<span className={getTextClass('/dashboard')}>ホーム</span>
</Link>
</li>
{/* Exercises */}
<li>
<Link
href="/exercises"
className={getLinkClass('/exercises')}
>
<div className="flex h-10 w-10 items-center justify-center text-2xl">📝</div>
<span className={getTextClass('/exercises')}>演習</span>
</Link>
</li>
{/* Grades */}
<li>
<Link
href="/grades"
className={getLinkClass('/grades')}
>
<div className="flex h-10 w-10 items-center justify-center text-2xl">🔖</div>
<span className={getTextClass('/grades')}>成績</span>
</Link>
</li>
</ul>
</div>
</aside>
);
}