fix: two scrollbars appear, and the sidebar follows the scroll

This commit is contained in:
daidr
2023-04-13 03:12:21 +08:00
parent c075d0dd79
commit 323231e47c
2 changed files with 17 additions and 11 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ export const DashboardMain: React.FC<{
const isMobileLayout = useMobileLayout()
return (
<div className="flex-1 overflow-scroll">
<div className="flex-1">
<div
className={cn(
fullWidth ? "relative" : "min-w-[270px] relative px-5 py-5 md:px-10",
+16 -10
View File
@@ -23,19 +23,25 @@ export const DashboardSidebar: React.FC<{
<div
className={`${
isOpen ? `w-sidebar` : "w-20"
} relative bg-slate-50 z-10 h-full transition-all flex flex-col`}
} transition-[width] relative flex-shrink-0`}
>
{children(isOpen)}
<div className="w-[1px] bg-border absolute top-0 right-0 bottom-0"></div>
<div
className="absolute top-5 -right-3 bg-accent rounded-full cursor-pointer text-white w-6 h-6"
onClick={() => setIsOpen(!isOpen)}
className={`${
isOpen ? `w-sidebar` : "w-20"
} transition-[width] fixed bg-slate-50 z-10 h-full flex flex-col`}
>
{isOpen ? (
<i className="i-mingcute:left-line text-2xl inline-block w-6 h-6" />
) : (
<i className="i-mingcute:right-line text-2xl inline-block w-6 h-6" />
)}
{children(isOpen)}
<div className="w-[1px] bg-border absolute top-0 right-0 bottom-0"></div>
<div
className="absolute top-5 -right-3 bg-accent rounded-full cursor-pointer text-white w-6 h-6"
onClick={() => setIsOpen(!isOpen)}
>
{isOpen ? (
<i className="i-mingcute:left-line text-2xl inline-block w-6 h-6" />
) : (
<i className="i-mingcute:right-line text-2xl inline-block w-6 h-6" />
)}
</div>
</div>
</div>
)