mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
fix: show secondary menu if even there is no main one (#5262)
This commit is contained in:
parent
650f989dbb
commit
8a198ef20a
1 changed files with 15 additions and 12 deletions
|
@ -19,6 +19,7 @@ import {
|
||||||
import useHideableNavbar from '@theme/hooks/useHideableNavbar';
|
import useHideableNavbar from '@theme/hooks/useHideableNavbar';
|
||||||
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
|
import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
|
||||||
import useWindowSize from '@theme/hooks/useWindowSize';
|
import useWindowSize from '@theme/hooks/useWindowSize';
|
||||||
|
import {useActivePlugin} from '@theme/hooks/useDocs';
|
||||||
import NavbarItem, {Props as NavbarItemConfig} from '@theme/NavbarItem';
|
import NavbarItem, {Props as NavbarItemConfig} from '@theme/NavbarItem';
|
||||||
import Logo from '@theme/Logo';
|
import Logo from '@theme/Logo';
|
||||||
import IconMenu from '@theme/IconMenu';
|
import IconMenu from '@theme/IconMenu';
|
||||||
|
@ -175,6 +176,7 @@ function NavbarMobileSidebar({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="navbar-sidebar__item navbar-sidebar__item--secondary menu">
|
<div className="navbar-sidebar__item navbar-sidebar__item--secondary menu">
|
||||||
|
{items.length > 0 && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="clean-btn navbar-sidebar__back"
|
className="clean-btn navbar-sidebar__back"
|
||||||
|
@ -185,6 +187,7 @@ function NavbarMobileSidebar({
|
||||||
← Back to main menu
|
← Back to main menu
|
||||||
</Translate>
|
</Translate>
|
||||||
</button>
|
</button>
|
||||||
|
)}
|
||||||
{secondaryMenu.content}
|
{secondaryMenu.content}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -199,7 +202,7 @@ function Navbar(): JSX.Element {
|
||||||
|
|
||||||
const mobileSidebar = useMobileSidebar();
|
const mobileSidebar = useMobileSidebar();
|
||||||
const colorModeToggle = useColorModeToggle();
|
const colorModeToggle = useColorModeToggle();
|
||||||
|
const activeDocPlugin = useActivePlugin();
|
||||||
const {navbarRef, isNavbarVisible} = useHideableNavbar(hideOnScroll);
|
const {navbarRef, isNavbarVisible} = useHideableNavbar(hideOnScroll);
|
||||||
|
|
||||||
const items = useNavbarItems();
|
const items = useNavbarItems();
|
||||||
|
@ -218,7 +221,7 @@ function Navbar(): JSX.Element {
|
||||||
})}>
|
})}>
|
||||||
<div className="navbar__inner">
|
<div className="navbar__inner">
|
||||||
<div className="navbar__items">
|
<div className="navbar__items">
|
||||||
{items?.length > 0 && (
|
{(items?.length > 0 || activeDocPlugin) && (
|
||||||
<button
|
<button
|
||||||
aria-label="Navigation bar toggle"
|
aria-label="Navigation bar toggle"
|
||||||
className="navbar__toggle clean-btn"
|
className="navbar__toggle clean-btn"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue