Skip to content

Commit d340056

Browse files
committed
docs: fix bug in layout change when using some chrome extensions
1 parent 9bb4c03 commit d340056

2 files changed

Lines changed: 25 additions & 22 deletions

File tree

www/packages/docs-ui/src/layouts/main-content.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ export const MainContentLayout = ({
3535
if (!isBrowser) {
3636
return
3737
}
38+
const rootLayout = document.getElementById("root-layout")
3839
if (desktopSidebarOpen) {
39-
document.body.classList.add("lg:grid-cols-[221px_1fr]")
40+
rootLayout?.classList.add("lg:grid-cols-[221px_1fr]")
4041
} else {
41-
document.body.classList.remove("lg:grid-cols-[221px_1fr]")
42+
rootLayout?.classList.remove("lg:grid-cols-[221px_1fr]")
4243
}
4344
}, [desktopSidebarOpen, isBrowser])
4445

@@ -70,8 +71,7 @@ export const MainContentLayout = ({
7071
<div
7172
className={clsx(
7273
"pt-docs_4 lg:pt-docs_6 pb-docs_8 lg:pb-docs_4",
73-
showContentMenu &&
74-
"grid grid-cols-1 lg:mx-auto",
74+
showContentMenu && "grid grid-cols-1 lg:mx-auto",
7575
desktopSidebarOpen && "lg:grid-cols-[1fr_221px]",
7676
chatOpened && showCollapsedNavbar && "pl-docs_1",
7777
contentClassName

www/packages/docs-ui/src/layouts/root.tsx

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,27 @@ export const RootLayout = ({
1919
...mainProps
2020
}: RootLayoutProps) => {
2121
return (
22-
<body
23-
className={clsx(
24-
"bg-medusa-bg-subtle font-base text-medium w-full",
25-
"text-medusa-fg-base",
26-
"h-screen overflow-hidden",
27-
"grid grid-cols-1 lg:mx-auto lg:grid-cols-[221px_1fr]",
28-
bodyClassName
29-
)}
30-
>
31-
<RootProviders>
32-
<ProvidersComponent>
33-
<Sidebar {...sidebarProps} />
34-
<div className={clsx("relative", "h-screen", "flex")}>
35-
<MainContentLayout {...mainProps} />
36-
<AiAssistantChatWindow />
37-
</div>
38-
</ProvidersComponent>
39-
</RootProviders>
22+
<body className={clsx("h-screen w-full overflow-hidden")}>
23+
<div
24+
className={clsx(
25+
"bg-medusa-bg-subtle font-base text-medium w-full",
26+
"text-medusa-fg-base",
27+
"h-full overflow-hidden",
28+
"grid grid-cols-1 lg:mx-auto lg:grid-cols-[221px_1fr]",
29+
bodyClassName
30+
)}
31+
id="root-layout"
32+
>
33+
<RootProviders>
34+
<ProvidersComponent>
35+
<Sidebar {...sidebarProps} />
36+
<div className={clsx("relative", "h-screen", "flex")}>
37+
<MainContentLayout {...mainProps} />
38+
<AiAssistantChatWindow />
39+
</div>
40+
</ProvidersComponent>
41+
</RootProviders>
42+
</div>
4043
</body>
4144
)
4245
}

0 commit comments

Comments
 (0)