Spaces:
Build error
Build error
Upload components/Sidebar.jsx with huggingface_hub
Browse files- components/Sidebar.jsx +8 -18
components/Sidebar.jsx
CHANGED
|
@@ -33,18 +33,12 @@ const secondaryNavigation = [
|
|
| 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">
|
|
@@ -59,7 +53,6 @@ export default function Sidebar({ isOpen, onClose }) {
|
|
| 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
|
|
@@ -67,15 +60,15 @@ export default function Sidebar({ isOpen, onClose }) {
|
|
| 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-
|
| 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'
|
|
@@ -85,7 +78,7 @@ export default function Sidebar({ isOpen, onClose }) {
|
|
| 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 |
)}
|
|
@@ -98,7 +91,7 @@ export default function Sidebar({ isOpen, onClose }) {
|
|
| 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-
|
| 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"
|
|
@@ -109,8 +102,7 @@ export default function Sidebar({ isOpen, onClose }) {
|
|
| 109 |
))}
|
| 110 |
</div>
|
| 111 |
|
| 112 |
-
|
| 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"
|
|
@@ -132,15 +124,13 @@ export default function Sidebar({ isOpen, onClose }) {
|
|
| 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>
|
|
|
|
| 33 |
|
| 34 |
export default function Sidebar({ isOpen, onClose }) {
|
| 35 |
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
const SidebarContent = () => (
|
| 38 |
<div className="flex flex-col h-full bg-white dark:bg-dark-surface border-r border-gray-200 dark:border-dark-border">
|
|
|
|
| 39 |
<div className="flex items-center justify-between h-16 px-6 border-b border-gray-200 dark:border-dark-border">
|
| 40 |
<div className="flex items-center gap-2">
|
| 41 |
+
<div className="w-8 h-8 bg-primary-600 rounded-lg flex items-center justify-center text-white font-bold shadow-lg shadow-primary-500/30">
|
| 42 |
N
|
| 43 |
</div>
|
| 44 |
<span className="text-xl font-bold text-gray-900 dark:text-white tracking-tight">
|
|
|
|
| 53 |
</button>
|
| 54 |
</div>
|
| 55 |
|
|
|
|
| 56 |
<div className="flex-1 overflow-y-auto py-4 px-3 space-y-1">
|
| 57 |
<div className="px-3 mb-2 text-xs font-semibold text-gray-400 uppercase tracking-wider">
|
| 58 |
Main Menu
|
|
|
|
| 60 |
{navigation.map((item) => (
|
| 61 |
<Link key={item.name} href={item.href}>
|
| 62 |
<div
|
| 63 |
+
className={`group flex items-center justify-between px-3 py-2 text-sm font-medium rounded-md transition-all duration-200 ${
|
| 64 |
router.pathname === item.href
|
| 65 |
+
? 'bg-primary-50 text-primary-700 dark:bg-primary-900/20 dark:text-primary-400 shadow-sm'
|
| 66 |
: 'text-gray-700 hover:bg-gray-50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-white'
|
| 67 |
}`}
|
| 68 |
>
|
| 69 |
<div className="flex items-center">
|
| 70 |
<item.icon
|
| 71 |
+
className={`mr-3 h-5 w-5 flex-shrink-0 transition-colors ${
|
| 72 |
router.pathname === item.href
|
| 73 |
? 'text-primary-500'
|
| 74 |
: 'text-gray-400 group-hover:text-gray-500'
|
|
|
|
| 78 |
{item.name}
|
| 79 |
</div>
|
| 80 |
{item.count && (
|
| 81 |
+
<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 ring-1 ring-inset ring-primary-700/10">
|
| 82 |
{item.count}
|
| 83 |
</span>
|
| 84 |
)}
|
|
|
|
| 91 |
</div>
|
| 92 |
{secondaryNavigation.map((item) => (
|
| 93 |
<Link key={item.name} href={item.href}>
|
| 94 |
+
<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-200">
|
| 95 |
<item.icon
|
| 96 |
className="mr-3 h-5 w-5 flex-shrink-0 text-gray-400 group-hover:text-gray-500"
|
| 97 |
aria-hidden="true"
|
|
|
|
| 102 |
))}
|
| 103 |
</div>
|
| 104 |
|
| 105 |
+
<div className="border-t border-gray-200 dark:border-dark-border p-4 bg-gray-50 dark:bg-gray-800/50">
|
|
|
|
| 106 |
<div className="flex items-center">
|
| 107 |
<img
|
| 108 |
className="h-9 w-9 rounded-full object-cover border-2 border-white dark:border-gray-600 shadow-sm"
|
|
|
|
| 124 |
|
| 125 |
return (
|
| 126 |
<>
|
|
|
|
| 127 |
<div className={`fixed inset-0 z-50 lg:hidden ${isOpen ? 'block' : 'hidden'}`}>
|
| 128 |
<div className="fixed inset-0 bg-gray-600 bg-opacity-75" onClick={onClose}></div>
|
| 129 |
+
<div className="fixed inset-y-0 left-0 flex flex-col w-64 max-w-xs animate-slide-up">
|
| 130 |
<SidebarContent />
|
| 131 |
</div>
|
| 132 |
</div>
|
| 133 |
|
|
|
|
| 134 |
<div className="hidden lg:fixed lg:inset-y-0 lg:flex lg:w-64 lg:flex-col">
|
| 135 |
<SidebarContent />
|
| 136 |
</div>
|