forked from Northgate-Systems/RemitX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSidebar.tsx
More file actions
140 lines (127 loc) · 6.74 KB
/
Copy pathSidebar.tsx
File metadata and controls
140 lines (127 loc) · 6.74 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useState } from "react";
const navItems = [
{ href: "/dashboard", icon: "dashboard", label: "Dashboard" },
{ href: "/send", icon: "payments", label: "Send Money" },
{ href: "/routes", icon: "compare_arrows", label: "Route Comparison" },
{ href: "/anchors", icon: "account_balance", label: "Anchor Fees" },
{ href: "/rates", icon: "currency_exchange", label: "Rates/DEX" },
{ href: "/activity", icon: "history", label: "Activity" },
{ href: "/review", icon: "fact_check", label: "Review" },
];
export default function Sidebar({ isOpen, onClose }: { isOpen?: boolean; onClose?: () => void }) {
const pathname = usePathname();
const isActive = (href: string) => {
if (href === "/dashboard") return pathname === "/dashboard";
return pathname.startsWith(href);
};
return (
<>
{/* Mobile Overlay */}
<div
className={`sidebar-overlay lg:hidden ${isOpen ? "open" : ""}`}
onClick={onClose}
/>
{/* Sidebar */}
<aside className={`w-sidebar-width h-screen fixed left-0 top-0 bg-surface/80 dark:bg-inverse-surface/90 backdrop-blur-xl border-r border-outline-variant/50 dark:border-outline/30 flex flex-col py-5 z-50 overflow-y-auto custom-scrollbar sidebar-desktop transition-all duration-300 lg:translate-x-0 ${isOpen ? "open" : ""}`}>
{/* Logo */}
<div className="px-5 mb-6">
<Link href="/" className="flex items-center gap-2.5 group" onClick={onClose}>
<div className="w-9 h-9 bg-gradient-to-br from-primary to-secondary rounded-xl flex items-center justify-center text-on-primary shadow-lg shadow-primary/20 transition-all duration-300 group-hover:shadow-xl group-hover:shadow-primary/30 group-hover:scale-105">
<span className="material-symbols-outlined text-lg" style={{ fontVariationSettings: "'FILL' 1" }}>account_balance</span>
</div>
<div>
<h1 className="text-base font-bold text-primary dark:text-primary-fixed leading-tight">RemitX</h1>
<p className="text-[10px] font-medium text-outline/70 dark:text-outline tracking-wider uppercase">Stellar Network</p>
</div>
</Link>
</div>
{/* Close button on mobile */}
{onClose && (
<button onClick={onClose} className="lg:hidden absolute top-4 right-4 p-1.5 text-on-surface-variant hover:text-primary rounded-lg hover:bg-surface-container-low transition-all">
<span className="material-symbols-outlined text-lg">close</span>
</button>
)}
{/* Navigation */}
<nav className="flex-1 px-3 space-y-0.5">
{navItems.map((item, index) => {
const active = isActive(item.href);
return (
<Link
key={item.href}
href={item.href}
onClick={onClose}
className={`group relative flex items-center gap-3 px-3 py-2 rounded-xl transition-all duration-200 animate-fade-in-up ${
active
? "text-white font-semibold"
: "text-on-surface-variant/70 dark:text-outline hover:text-primary dark:hover:text-primary-fixed-dim"
}`}
style={{ animationDelay: `${index * 50}ms` }}
>
{/* Active background gradient */}
{active && (
<>
<div className="absolute inset-0 bg-gradient-to-r from-primary via-primary/90 to-primary/70 rounded-xl shadow-lg shadow-primary/25" />
{/* Left accent bar */}
<div className="absolute left-0 top-1/2 -translate-y-1/2 w-1 h-5 bg-white rounded-r-full shadow-lg shadow-white/30" />
{/* Glow effect */}
<div className="absolute -inset-1 bg-primary/20 rounded-xl blur-md -z-10" />
</>
)}
{/* Hover background (non-active) */}
{!active && (
<div className="absolute inset-0 rounded-xl opacity-0 group-hover:opacity-100 bg-gradient-to-r from-primary/5 via-primary/3 to-transparent transition-opacity duration-200" />
)}
{/* Icon */}
<span className={`relative z-10 material-symbols-outlined transition-all duration-300 ${
active ? "text-white text-lg" : "text-lg group-hover:scale-110 group-hover:text-primary dark:group-hover:text-primary-fixed-dim"
}`}>
{item.icon}
</span>
{/* Label */}
<span className={`relative z-10 text-sm transition-all duration-200 ${
active ? "text-white" : "group-hover:translate-x-0.5"
}`}>
{item.label}
</span>
{/* Active indicator dot */}
{active && (
<span className="relative z-10 ml-auto w-1.5 h-1.5 rounded-full bg-white/90 shadow-sm shadow-white/50 animate-pulse" />
)}
</Link>
);
})}
</nav>
{/* Bottom section */}
<div className="px-3 mt-auto pt-4 border-t border-outline-variant/30 dark:border-outline/20 space-y-1">
<Link
href="/"
className="group relative flex items-center gap-3 px-3 py-2.5 rounded-xl bg-gradient-to-r from-primary to-secondary text-white font-medium text-sm shadow-lg shadow-primary/20 hover:shadow-xl hover:shadow-primary/30 hover:scale-[1.02] active:scale-95 transition-all duration-200 overflow-hidden"
onClick={onClose}
>
{/* Shimmer overlay */}
<div className="absolute inset-0 bg-gradient-to-r from-transparent via-white/10 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700" />
<span className="relative z-10 material-symbols-outlined text-lg">add_circle</span>
<span className="relative z-10">Add Funds</span>
</Link>
<Link
href="#"
className="flex items-center gap-3 px-3 py-2 text-xs text-on-surface-variant/60 hover:text-primary rounded-xl hover:bg-primary/5 transition-all duration-200"
>
<span className="material-symbols-outlined text-lg">help</span>
<span>Support</span>
</Link>
<Link
href="/"
className="flex items-center gap-3 px-3 py-2 text-xs text-on-surface-variant/60 hover:text-error rounded-xl hover:bg-error/5 transition-all duration-200"
>
<span className="material-symbols-outlined text-lg">logout</span>
<span>Sign Out</span>
</Link>
</div>
</aside>
</>
);
}