From cdd2343e0a752d735518d79123fad36ea4732e6a Mon Sep 17 00:00:00 2001 From: siriwatknp Date: Tue, 13 Aug 2024 15:13:10 +0700 Subject: [PATCH] fix(layout-v6): correct EdgeSidebarContent height for temporary --- blocks/layout-core-v6/EdgeSidebar.tsx | 16 ++++++++++------ blocks/layout-core-v6/EdgeSidebarContent.tsx | 2 +- blocks/layout-core-v6/EdgeSidebarRight.tsx | 16 ++++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/blocks/layout-core-v6/EdgeSidebar.tsx b/blocks/layout-core-v6/EdgeSidebar.tsx index 6855738f..d7454462 100644 --- a/blocks/layout-core-v6/EdgeSidebar.tsx +++ b/blocks/layout-core-v6/EdgeSidebar.tsx @@ -28,12 +28,16 @@ function applyTemporaryStyles(params: Omit) { { "--EdgeSidebar-temporaryWidth": width, }, - ...(fullHeight && { - zIndex: 5, - [`& .${layoutClasses.EdgeSidebarContent}`]: { - top: 0, - }, - }), + ...(fullHeight + ? { + zIndex: 5, + [`& .${layoutClasses.EdgeSidebarContent}`]: { + top: 0, + }, + } + : { + "--SidebarContent-offset": "var(--Header-height)", + }), }; } diff --git a/blocks/layout-core-v6/EdgeSidebarContent.tsx b/blocks/layout-core-v6/EdgeSidebarContent.tsx index 72082db1..85658505 100644 --- a/blocks/layout-core-v6/EdgeSidebarContent.tsx +++ b/blocks/layout-core-v6/EdgeSidebarContent.tsx @@ -18,7 +18,7 @@ const StyledEdgeSidebarContent = styled("div")(({ theme }) => ({ zIndex: 2, width: "var(--_temporary, var(--EdgeSidebar-temporaryWidth)) var(--_permanent, calc(var(--SidebarContent-width) - var(--EdgeSidebar-sidelineWidth, 0px)))", - height: "var(--_temporary, 100%)", + height: "var(--_temporary, calc(100% - var(--SidebarContent-offset, 0px)))", overflowY: "var(--_temporary, auto)" as any, transition: `var(--_temporary, opacity 0.3s, transform 0.3s) var(--_permanent, opacity 0.4s, width 0.3s var(--SidebarContent-transitionDelay, 0s), transform 0.3s var(--SidebarContent-transitionDelay, 0s), box-shadow 0.3s var(--SidebarContent-transitionDelay, 0s))`, diff --git a/blocks/layout-core-v6/EdgeSidebarRight.tsx b/blocks/layout-core-v6/EdgeSidebarRight.tsx index 169735f1..069fd04a 100644 --- a/blocks/layout-core-v6/EdgeSidebarRight.tsx +++ b/blocks/layout-core-v6/EdgeSidebarRight.tsx @@ -30,12 +30,16 @@ export function applyTemporaryRightStyles( { "--EdgeSidebar-temporaryWidth": width, }, - ...(fullHeight && { - zIndex: 5, - [`& .${layoutClasses.EdgeSidebarContent}`]: { - top: 0, - }, - }), + ...(fullHeight + ? { + zIndex: 5, + [`& .${layoutClasses.EdgeSidebarContent}`]: { + top: 0, + }, + } + : { + "--SidebarContent-offset": "var(--Header-height)", + }), }; }