From 2021806d942ef20f7ec260a027b903c41d90a8a3 Mon Sep 17 00:00:00 2001 From: Barrett Date: Tue, 10 Dec 2024 18:26:18 -0600 Subject: [PATCH] layout & sidebar styling continued --- web/src/components/Sidebar/Sidebar.tsx | 22 +++--------------- .../AuthenticatedLayout.tsx | 23 ++++--------------- 2 files changed, 8 insertions(+), 37 deletions(-) diff --git a/web/src/components/Sidebar/Sidebar.tsx b/web/src/components/Sidebar/Sidebar.tsx index c8ef9de..f2e99f6 100644 --- a/web/src/components/Sidebar/Sidebar.tsx +++ b/web/src/components/Sidebar/Sidebar.tsx @@ -17,12 +17,8 @@ function classNames(...classes: string[]) { } const Sidebar = ({ - isCollapsed = false, - setIsCollapsed, setSidebarOpen, }: { - isCollapsed: boolean - setIsCollapsed: (collapsed: boolean) => void setSidebarOpen?: (open: boolean) => void }) => { const { logOut } = useAuth() @@ -60,7 +56,7 @@ const Sidebar = ({ ? 'bg-gray-700' : 'bg-gray-800 hover:bg-gray-700', 'shadow-lg', - isCollapsed ? 'justify-center' : 'justify-start' + 'justify-start' )} onClick={() => { if (setSidebarOpen) setSidebarOpen(false) @@ -71,12 +67,7 @@ const Sidebar = ({ aria-hidden="true" aria-label={name} /> - {!isCollapsed && {name}} - {isCollapsed && ( - - {name} - - )} + {name} ) @@ -99,15 +90,8 @@ const Sidebar = ({ return (
-
+
SWPPP-TOP -
{/* Navigation */} diff --git a/web/src/layouts/AuthenticatedLayout/AuthenticatedLayout.tsx b/web/src/layouts/AuthenticatedLayout/AuthenticatedLayout.tsx index a054d9e..0f8e287 100644 --- a/web/src/layouts/AuthenticatedLayout/AuthenticatedLayout.tsx +++ b/web/src/layouts/AuthenticatedLayout/AuthenticatedLayout.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, Fragment, ReactNode } from 'react' +import { useState, Fragment, ReactNode } from 'react' import { Dialog, Transition } from '@headlessui/react' import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline' @@ -11,18 +11,9 @@ interface AuthenticatedLayoutProps { const AuthenticatedLayout = ({ children }: AuthenticatedLayoutProps) => { const [sidebarOpen, setSidebarOpen] = useState(false) - const [isCollapsed, setIsCollapsed] = useState(() => { - // Persist collapsed state using localStorage - const savedState = localStorage.getItem('isSidebarCollapsed') - return savedState === 'true' - }) - - useEffect(() => { - localStorage.setItem('isSidebarCollapsed', isCollapsed.toString()) - }, [isCollapsed]) return ( -
+
{/* Mobile Sidebar */} { leaveFrom="translate-x-0" leaveTo="-translate-x-full" > - + {/* Close Button */} - + @@ -72,7 +59,7 @@ const AuthenticatedLayout = ({ children }: AuthenticatedLayoutProps) => { {/* Desktop Sidebar */}
- +
{/* Main Content */}