|
|
@@ -28,43 +28,40 @@ export default function Sidebar({ isCollapsed: externalIsCollapsed, onToggleColl
|
|
|
return () => window.removeEventListener('resize', checkDesktop)
|
|
|
}, [])
|
|
|
|
|
|
- const handleButtonClick = () => {
|
|
|
- if (isDesktop) {
|
|
|
- toggleCollapse()
|
|
|
- } else {
|
|
|
- setIsMobileMenuOpen(true)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
return (
|
|
|
<>
|
|
|
- {/* Botón flotante unificado */}
|
|
|
+ {/* Botón del menú móvil */}
|
|
|
<button
|
|
|
type="button"
|
|
|
- className="fixed top-4 left-4 z-50 p-2 rounded-md shadow-lg border border-gray-200 bg-white"
|
|
|
- onClick={handleButtonClick}
|
|
|
+ className="lg:hidden fixed top-4 left-4 z-50 p-2 rounded-md shadow-lg border border-gray-200 bg-white"
|
|
|
+ onClick={() => setIsMobileMenuOpen(true)}
|
|
|
>
|
|
|
- {isDesktop ? (
|
|
|
- isCollapsed ? (
|
|
|
- <ChevronRight className="h-6 w-6 text-gray-600" />
|
|
|
- ) : (
|
|
|
- <ChevronLeft className="h-6 w-6 text-gray-600" />
|
|
|
- )
|
|
|
- ) : (
|
|
|
- <Menu className="h-6 w-6 text-gray-600" />
|
|
|
- )}
|
|
|
+ <Menu className="h-6 w-6 text-gray-600" />
|
|
|
</button>
|
|
|
|
|
|
{/* Sidebar de escritorio */}
|
|
|
{isDesktop && (
|
|
|
<div
|
|
|
- className="fixed inset-y-0 left-0 z-50 flex flex-col transition-all duration-300"
|
|
|
+ className="fixed inset-y-0 left-0 z-50 flex flex-col"
|
|
|
style={{ width: isCollapsed ? '4rem' : '18rem' }}
|
|
|
>
|
|
|
<div
|
|
|
className="flex grow flex-col overflow-y-auto border-r border-gray-200 bg-white shadow-sm"
|
|
|
>
|
|
|
- {/* Botón de toggle removido, ahora flotante */}
|
|
|
+ {/* Botón de toggle */}
|
|
|
+ <div className={`flex ${isCollapsed ? 'justify-center' : 'justify-end'} p-4 border-b border-gray-200`}>
|
|
|
+ <button
|
|
|
+ onClick={toggleCollapse}
|
|
|
+ className="p-1.5 rounded-md hover:bg-gray-100 transition-colors"
|
|
|
+ title={isCollapsed ? 'Expandir sidebar' : 'Colapsar sidebar'}
|
|
|
+ >
|
|
|
+ {isCollapsed ? (
|
|
|
+ <ChevronRight className="h-4 w-4 text-gray-600" />
|
|
|
+ ) : (
|
|
|
+ <ChevronLeft className="h-4 w-4 text-gray-600" />
|
|
|
+ )}
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
|
|
|
<SidebarHeader isCollapsed={isCollapsed} />
|
|
|
<SidebarNavigation isCollapsed={isCollapsed} />
|