Spaces:
Build error
Build error
Upload components/Sidebar.jsx with huggingface_hub
Browse files- components/Sidebar.jsx +149 -0
components/Sidebar.jsx
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import React, { useState } from 'react';
|
| 2 |
+
import Link from 'next/link';
|
| 3 |
+
import { useRouter } from 'next/router';
|
| 4 |
+
import {
|
| 5 |
+
LayoutDashboard,
|
| 6 |
+
FolderKanban,
|
| 7 |
+
CheckSquare,
|
| 8 |
+
Users,
|
| 9 |
+
BarChart2,
|
| 10 |
+
Calendar,
|
| 11 |
+
MessageSquare,
|
| 12 |
+
Settings,
|
| 13 |
+
LogOut,
|
| 14 |
+
X,
|
| 15 |
+
ChevronDown,
|
| 16 |
+
HelpCircle
|
| 17 |
+
} from 'lucide-react';
|
| 18 |
+
|
| 19 |
+
const navigation = [
|
| 20 |
+
{ name: 'Dashboard', href: '/', icon: LayoutDashboard, current: true },
|
| 21 |
+
{ name: 'Projects', href: '/projects', icon: FolderKanban, current: false },
|
| 22 |
+
{ name: 'Tasks', href: '/tasks', icon: CheckSquare, current: false },
|
| 23 |
+
{ name: 'Team', href: '/team', icon: Users, current: false },
|
| 24 |
+
{ name: 'Analytics', href: '/analytics', icon: BarChart2, current: false },
|
| 25 |
+
{ name: 'Messages', href: '/messages', icon: MessageSquare, current: false, count: 3 },
|
| 26 |
+
{ name: 'Calendar', href: '/calendar', icon: Calendar, current: false },
|
| 27 |
+
];
|
| 28 |
+
|
| 29 |
+
const secondaryNavigation = [
|
| 30 |
+
{ name: 'Settings', href: '/settings', icon: Settings },
|
| 31 |
+
{ name: 'Help & Support', href: '/help', icon: HelpCircle },
|
| 32 |
+
];
|
| 33 |
+
|
| 34 |
+
export default function Sidebar({ isOpen, onClose }) {
|
| 35 |
+
const router = useRouter();
|
| 36 |
+
const [expandedMenus, setExpandedMenus] = useState({});
|
| 37 |
+
|
| 38 |
+
const toggleMenu = (name) => {
|
| 39 |
+
setExpandedMenus(prev => ({ ...prev, [name]: !prev[name] }));
|
| 40 |
+
};
|
| 41 |
+
|
| 42 |
+
const SidebarContent = () => (
|
| 43 |
+
<div className="flex flex-col h-full bg-white dark:bg-dark-surface border-r border-gray-200 dark:border-dark-border">
|
| 44 |
+
{/* Logo Area */}
|
| 45 |
+
<div className="flex items-center justify-between h-16 px-6 border-b border-gray-200 dark:border-dark-border">
|
| 46 |
+
<div className="flex items-center gap-2">
|
| 47 |
+
<div className="w-8 h-8 bg-primary-600 rounded-lg flex items-center justify-center text-white font-bold">
|
| 48 |
+
N
|
| 49 |
+
</div>
|
| 50 |
+
<span className="text-xl font-bold text-gray-900 dark:text-white tracking-tight">
|
| 51 |
+
Nexus
|
| 52 |
+
</span>
|
| 53 |
+
</div>
|
| 54 |
+
<button
|
| 55 |
+
onClick={onClose}
|
| 56 |
+
className="lg:hidden text-gray-400 hover:text-gray-500"
|
| 57 |
+
>
|
| 58 |
+
<X className="w-6 h-6" />
|
| 59 |
+
</button>
|
| 60 |
+
</div>
|
| 61 |
+
|
| 62 |
+
{/* Navigation */}
|
| 63 |
+
<div className="flex-1 overflow-y-auto py-4 px-3 space-y-1">
|
| 64 |
+
<div className="px-3 mb-2 text-xs font-semibold text-gray-400 uppercase tracking-wider">
|
| 65 |
+
Main Menu
|
| 66 |
+
</div>
|
| 67 |
+
{navigation.map((item) => (
|
| 68 |
+
<Link key={item.name} href={item.href}>
|
| 69 |
+
<div
|
| 70 |
+
className={`group flex items-center justify-between px-3 py-2 text-sm font-medium rounded-md transition-colors duration-150 ${
|
| 71 |
+
router.pathname === item.href
|
| 72 |
+
? 'bg-primary-50 text-primary-700 dark:bg-primary-900/20 dark:text-primary-400'
|
| 73 |
+
: 'text-gray-700 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-white'
|
| 74 |
+
}`}
|
| 75 |
+
>
|
| 76 |
+
<div className="flex items-center">
|
| 77 |
+
<item.icon
|
| 78 |
+
className={`mr-3 h-5 w-5 flex-shrink-0 ${
|
| 79 |
+
router.pathname === item.href
|
| 80 |
+
? 'text-primary-500'
|
| 81 |
+
: 'text-gray-400 group-hover:text-gray-500'
|
| 82 |
+
}`}
|
| 83 |
+
aria-hidden="true"
|
| 84 |
+
/>
|
| 85 |
+
{item.name}
|
| 86 |
+
</div>
|
| 87 |
+
{item.count && (
|
| 88 |
+
<span className="bg-primary-100 text-primary-600 py-0.5 px-2 rounded-full text-xs font-medium dark:bg-primary-900 dark:text-primary-300">
|
| 89 |
+
{item.count}
|
| 90 |
+
</span>
|
| 91 |
+
)}
|
| 92 |
+
</div>
|
| 93 |
+
</Link>
|
| 94 |
+
))}
|
| 95 |
+
|
| 96 |
+
<div className="px-3 mt-8 mb-2 text-xs font-semibold text-gray-400 uppercase tracking-wider">
|
| 97 |
+
System
|
| 98 |
+
</div>
|
| 99 |
+
{secondaryNavigation.map((item) => (
|
| 100 |
+
<Link key={item.name} href={item.href}>
|
| 101 |
+
<div className="group flex items-center px-3 py-2 text-sm font-medium rounded-md text-gray-700 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-white transition-colors duration-150">
|
| 102 |
+
<item.icon
|
| 103 |
+
className="mr-3 h-5 w-5 flex-shrink-0 text-gray-400 group-hover:text-gray-500"
|
| 104 |
+
aria-hidden="true"
|
| 105 |
+
/>
|
| 106 |
+
{item.name}
|
| 107 |
+
</div>
|
| 108 |
+
</Link>
|
| 109 |
+
))}
|
| 110 |
+
</div>
|
| 111 |
+
|
| 112 |
+
{/* User Profile (Bottom) */}
|
| 113 |
+
<div className="border-t border-gray-200 dark:border-dark-border p-4">
|
| 114 |
+
<div className="flex items-center">
|
| 115 |
+
<img
|
| 116 |
+
className="h-9 w-9 rounded-full object-cover border-2 border-white dark:border-gray-600 shadow-sm"
|
| 117 |
+
src="https://picsum.photos/seed/user1/200/200"
|
| 118 |
+
alt=""
|
| 119 |
+
/>
|
| 120 |
+
<div className="ml-3">
|
| 121 |
+
<p className="text-sm font-medium text-gray-700 dark:text-gray-200">Alex Morgan</p>
|
| 122 |
+
<p className="text-xs text-gray-500 dark:text-gray-400">Product Manager</p>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
<button className="mt-3 w-full flex items-center justify-center px-3 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 dark:bg-gray-700 dark:text-gray-200 dark:border-gray-600 dark:hover:bg-gray-600 transition-colors">
|
| 126 |
+
<LogOut className="w-4 h-4 mr-2" />
|
| 127 |
+
Sign Out
|
| 128 |
+
</button>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
);
|
| 132 |
+
|
| 133 |
+
return (
|
| 134 |
+
<>
|
| 135 |
+
{/* Mobile Sidebar */}
|
| 136 |
+
<div className={`fixed inset-0 z-50 lg:hidden ${isOpen ? 'block' : 'hidden'}`}>
|
| 137 |
+
<div className="fixed inset-0 bg-gray-600 bg-opacity-75" onClick={onClose}></div>
|
| 138 |
+
<div className="fixed inset-y-0 left-0 flex flex-col w-64 max-w-xs">
|
| 139 |
+
<SidebarContent />
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
|
| 143 |
+
{/* Desktop Sidebar */}
|
| 144 |
+
<div className="hidden lg:fixed lg:inset-y-0 lg:flex lg:w-64 lg:flex-col">
|
| 145 |
+
<SidebarContent />
|
| 146 |
+
</div>
|
| 147 |
+
</>
|
| 148 |
+
);
|
| 149 |
+
}
|