From 323231e47c0ac7304375f53bdb5a0baa26b6ca9f Mon Sep 17 00:00:00 2001 From: daidr Date: Thu, 13 Apr 2023 03:12:21 +0800 Subject: [PATCH] fix: two scrollbars appear, and the sidebar follows the scroll --- src/components/dashboard/DashboardMain.tsx | 2 +- src/components/dashboard/DashboardSidebar.tsx | 26 ++++++++++++------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/components/dashboard/DashboardMain.tsx b/src/components/dashboard/DashboardMain.tsx index e194930e..456a554c 100644 --- a/src/components/dashboard/DashboardMain.tsx +++ b/src/components/dashboard/DashboardMain.tsx @@ -12,7 +12,7 @@ export const DashboardMain: React.FC<{ const isMobileLayout = useMobileLayout() return ( -
+
- {children(isOpen)} -
setIsOpen(!isOpen)} + className={`${ + isOpen ? `w-sidebar` : "w-20" + } transition-[width] fixed bg-slate-50 z-10 h-full flex flex-col`} > - {isOpen ? ( - - ) : ( - - )} + {children(isOpen)} +
+
setIsOpen(!isOpen)} + > + {isOpen ? ( + + ) : ( + + )} +
)