Skip to content

Commit 95e541d

Browse files
committed
fixing menu bar
1 parent 6611ac7 commit 95e541d

2 files changed

Lines changed: 42 additions & 3 deletions

File tree

src/css/custom.css

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ html[data-theme='dark'] .light-theme-display-component {
4848
}
4949
}
5050

51+
@media only screen and (min-width: 997px) and (max-width: 1250px) {
52+
:root {
53+
--ifm-navbar-sidebar-width: 320px;
54+
}
55+
}
56+
5157
@media only screen and (max-width: 1250px) {
5258
.navbar > .container,
5359
.navbar > .container-fluid {
@@ -63,15 +69,15 @@ html[data-theme='dark'] .light-theme-display-component {
6369
margin-left: auto;
6470
}
6571

66-
.navbar__items--right .navbar__item {
72+
.navbar__inner .navbar__items--right .navbar__item {
6773
display: none !important;
6874
}
6975

70-
.navbar__items--right > button {
76+
.navbar__inner .navbar__items--right > button {
7177
display: none !important;
7278
}
7379

74-
.navbar__items:not(.navbar__items--right) .navbar__item {
80+
.navbar__inner .navbar__items:not(.navbar__items--right) .navbar__item {
7581
display: none !important;
7682
}
7783
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Swizzled version of @docusaurus/theme-classic Navbar/MobileSidebar
3+
*
4+
* Change: also render the sidebar when `shown=true`, even above the default
5+
* 996px mobile breakpoint. This fixes the "gray screen only" bug when the
6+
* hamburger toggle is shown via CSS at intermediate widths (996–1250px).
7+
*/
8+
import React from 'react';
9+
import {
10+
useLockBodyScroll,
11+
useNavbarMobileSidebar,
12+
} from '@docusaurus/theme-common/internal';
13+
import NavbarMobileSidebarLayout from '@theme/Navbar/MobileSidebar/Layout';
14+
import NavbarMobileSidebarHeader from '@theme/Navbar/MobileSidebar/Header';
15+
import NavbarMobileSidebarPrimaryMenu from '@theme/Navbar/MobileSidebar/PrimaryMenu';
16+
import NavbarMobileSidebarSecondaryMenu from '@theme/Navbar/MobileSidebar/SecondaryMenu';
17+
18+
export default function NavbarMobileSidebar() {
19+
const mobileSidebar = useNavbarMobileSidebar();
20+
useLockBodyScroll(mobileSidebar.shown);
21+
// Render when Docusaurus considers it mobile OR when the user has explicitly
22+
// opened the sidebar (e.g. via a hamburger shown at custom wider breakpoints).
23+
if (!mobileSidebar.shouldRender && !mobileSidebar.shown) {
24+
return null;
25+
}
26+
return (
27+
<NavbarMobileSidebarLayout
28+
header={<NavbarMobileSidebarHeader />}
29+
primaryMenu={<NavbarMobileSidebarPrimaryMenu />}
30+
secondaryMenu={<NavbarMobileSidebarSecondaryMenu />}
31+
/>
32+
);
33+
}

0 commit comments

Comments
 (0)