diff --git a/src/theme/DocPage/Layout/Sidebar/index.tsx b/src/theme/DocPage/Layout/Sidebar/index.tsx
new file mode 100644
index 0000000..6d27035
--- /dev/null
+++ b/src/theme/DocPage/Layout/Sidebar/index.tsx
@@ -0,0 +1,54 @@
+import { useLocation } from '@docusaurus/router'
+import { ThemeClassNames } from '@docusaurus/theme-common'
+import { useDocsSidebar } from '@docusaurus/theme-common/internal'
+import {
+ globalStore,
+ selectHiddenSidebar,
+} from '@site/src/containers/GlobalStore'
+import type { Props } from '@theme/DocPage/Layout/Sidebar'
+import DocSidebar from '@theme/DocSidebar'
+import clsx from 'clsx'
+import React, { ReactNode } from 'react'
+import styles from './styles.module.css'
+
+// Reset sidebar state when sidebar changes
+// Use React key to unmount/remount the children
+// See https://github.com/facebook/docusaurus/issues/3414
+function ResetOnSidebarChange({ children }: { children: ReactNode }) {
+ const sidebar = useDocsSidebar()
+ return (
+
+ {children}
+
+ )
+}
+
+export default function DocPageLayoutSidebar({ sidebar }: Props): JSX.Element {
+ const { pathname } = useLocation()
+ const dispatch = globalStore.useDispatch()
+ const hiddenSidebar = globalStore.useSelector(selectHiddenSidebar)
+
+ return (
+
+ )
+}
diff --git a/src/theme/DocPage/Layout/Sidebar/styles.module.css b/src/theme/DocPage/Layout/Sidebar/styles.module.css
new file mode 100644
index 0000000..982c397
--- /dev/null
+++ b/src/theme/DocPage/Layout/Sidebar/styles.module.css
@@ -0,0 +1,24 @@
+:root {
+ --doc-sidebar-width: 300px;
+ --doc-sidebar-hidden-width: 30px;
+}
+
+.docSidebarContainer {
+ display: none;
+}
+
+@media (min-width: 997px) {
+ .docSidebarContainer {
+ display: block;
+ width: var(--doc-sidebar-width);
+ margin-top: calc(-1 * var(--ifm-navbar-height));
+ will-change: width;
+ transition: width var(--ifm-transition-fast) ease;
+ clip-path: inset(0);
+ }
+
+ .docSidebarContainerHidden {
+ width: var(--doc-sidebar-hidden-width);
+ cursor: pointer;
+ }
+}
diff --git a/src/theme/DocSidebar/Desktop/index.tsx b/src/theme/DocSidebar/Desktop/index.tsx
new file mode 100644
index 0000000..15c0da2
--- /dev/null
+++ b/src/theme/DocSidebar/Desktop/index.tsx
@@ -0,0 +1,29 @@
+import { useThemeConfig } from '@docusaurus/theme-common'
+import type { Props } from '@theme/DocSidebar/Desktop'
+import Content from '@theme/DocSidebar/Desktop/Content'
+import Logo from '@theme/Logo'
+import clsx from 'clsx'
+import React from 'react'
+import styles from './styles.module.css'
+
+function DocSidebarDesktop({ path, sidebar, onCollapse, isHidden }: Props) {
+ const {
+ navbar: { hideOnScroll },
+ docs: {},
+ } = useThemeConfig()
+
+ return (
+
+ {hideOnScroll && }
+
+
+ )
+}
+
+export default React.memo(DocSidebarDesktop)
diff --git a/src/theme/DocSidebar/Desktop/styles.module.css b/src/theme/DocSidebar/Desktop/styles.module.css
new file mode 100644
index 0000000..dc68288
--- /dev/null
+++ b/src/theme/DocSidebar/Desktop/styles.module.css
@@ -0,0 +1,43 @@
+@media (min-width: 997px) {
+ .sidebar {
+ display: flex;
+ flex-direction: column;
+ max-height: 100vh;
+ height: 100%;
+ position: sticky;
+ top: 0;
+ padding-top: var(--ifm-navbar-height);
+ width: var(--doc-sidebar-width);
+ transition: opacity 50ms ease;
+ }
+
+ .sidebarWithHideableNavbar {
+ padding-top: 0;
+ }
+
+ .sidebarHidden {
+ opacity: 0;
+ height: 0;
+ overflow: hidden;
+ visibility: hidden;
+ }
+
+ .sidebarLogo {
+ display: flex !important;
+ align-items: center;
+ margin: 0 var(--ifm-navbar-padding-horizontal);
+ min-height: var(--ifm-navbar-height);
+ max-height: var(--ifm-navbar-height);
+ color: inherit !important;
+ text-decoration: none !important;
+ }
+
+ .sidebarLogo img {
+ margin-right: 0.5rem;
+ height: 2rem;
+ }
+}
+
+.sidebarLogo {
+ display: none;
+}
diff --git a/src/theme/Navbar/Content/index.tsx b/src/theme/Navbar/Content/index.tsx
index 0757600..a2abd9c 100644
--- a/src/theme/Navbar/Content/index.tsx
+++ b/src/theme/Navbar/Content/index.tsx
@@ -31,31 +31,47 @@ function NavbarItems({ items }: { items: NavbarItemConfig[] }): JSX.Element {
)
}
+const SidebarToggleButton: React.FC<{
+ className: string
+ onToggle: () => void
+ shown: boolean
+}> = ({ className, onToggle, shown }) => {
+ return (
+
+ )
+}
+
export default function NavbarContent(): JSX.Element {
- const mobileSidebar = useNavbarMobileSidebar()
-
const items = useNavbarItems()
- const dispatch = globalStore.useDispatch()
- const hiddenDesktopSidebar = globalStore.useSelector(selectHiddenSidebar)
-
const localeDropdown = items.find((item) => item.type === 'localeDropdown')
const links = items.filter(
(item) => item.type === 'doc' || !!(item as any).to,
)
+ const mobileSidebar = useNavbarMobileSidebar()
+
+ const dispatch = globalStore.useDispatch()
+ const hiddenDesktopSidebar = globalStore.useSelector(selectHiddenSidebar)
+
return (
-
+
+
diff --git a/src/theme/Navbar/Content/styles.module.scss b/src/theme/Navbar/Content/styles.module.scss
index 13f775c..6629b11 100644
--- a/src/theme/Navbar/Content/styles.module.scss
+++ b/src/theme/Navbar/Content/styles.module.scss
@@ -145,3 +145,15 @@ Hide color mode toggle in small viewports
display: none;
}
}
+
+@include utils.responsive('lg', 'up') {
+ .sidebarButton.mobile {
+ display: none;
+ }
+}
+
+@include utils.responsive('lg', 'down') {
+ .sidebarButton.desktop {
+ display: none;
+ }
+}
diff --git a/src/theme/Navbar/index.scss b/src/theme/Navbar/index.scss
index 2a282f6..cd1c7d7 100644
--- a/src/theme/Navbar/index.scss
+++ b/src/theme/Navbar/index.scss
@@ -1,9 +1,14 @@
+.navbar-sidebar__brand {
+ --ifm-navbar-padding-horizontal: 1rem;
+}
+
.navbar {
--ifm-navbar-height: 3.875rem;
- --ifm-navbar-background-color: none;
--ifm-navbar-shadow: none;
--ifm-navbar-padding-horizontal: 0px;
- --ifm-navbar-padding-vertical: 8px;
+ --ifm-navbar-padding-vertical: 0.5rem;
+
+ background: none;
}
:root {