From 8b83bf94b6833a3e527845e80c996dd4b49836a5 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Tue, 23 May 2023 17:31:03 +0300 Subject: [PATCH] docs: hide sidebar button on pages with no sidebar (#4158) --- www/docs/src/context/sidebar.ts | 1 + www/docs/src/theme/DocPage/index.tsx | 3 +++ www/docs/src/theme/Navbar/Content/index.tsx | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/www/docs/src/context/sidebar.ts b/www/docs/src/context/sidebar.ts index 3260e69e28..b8de674ae2 100644 --- a/www/docs/src/context/sidebar.ts +++ b/www/docs/src/context/sidebar.ts @@ -1,6 +1,7 @@ import { createContext } from "react" type SidebarContextType = { + hasSidebar: boolean hiddenSidebar: boolean setHiddenSidebar: (value: boolean) => void hiddenSidebarContainer: boolean diff --git a/www/docs/src/theme/DocPage/index.tsx b/www/docs/src/theme/DocPage/index.tsx index 0faf996568..b9930cd753 100644 --- a/www/docs/src/theme/DocPage/index.tsx +++ b/www/docs/src/theme/DocPage/index.tsx @@ -91,6 +91,8 @@ export default function DocPage(props: Props): JSX.Element { } }) + console.log(sidebarName) + return ( <> @@ -107,6 +109,7 @@ export default function DocPage(props: Props): JSX.Element { {!mobileSidebar.disabled && } - {hideable && ( + {hideable && sidebarContext?.hasSidebar && (