Skip to content

Commit f9aedbb

Browse files
authored
Merge pull request #4804 from Blargian/mobile_menu
Bug fix: mobile menu crashing
2 parents 61500de + c86f092 commit f9aedbb

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/theme/Navbar/Content/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default function NavbarContent() {
8484
<button className="click-button primary-btn">Get started</button>
8585
</a>
8686
</div>
87-
<MobileSideBarMenu sidebar={items} menu={{ ...sidebars, dropdownCategories }} />
87+
<MobileSideBarMenu sidebar={items} menu={{ dropdownCategories }} />
8888
</div>
8989
</div>
9090
<div className={clsx("secondary-nav--items", styles.secondaryMenu)}>

src/theme/Navbar/MobileSidebar/SecondaryMenu/index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import {
3-
useNavbarMobileSidebar,
3+
useNavbarMobileSidebar,
44
} from '@docusaurus/theme-common/internal';
55
import Translate from '@docusaurus/Translate';
66
import SearchBar from "@theme/SearchBar";
@@ -9,18 +9,18 @@ import { ThemeClassNames } from '@docusaurus/theme-common'
99
import { useNavbarSecondaryMenu } from '@docusaurus/theme-common/internal';
1010
import styles from './styles.module.scss'
1111
import DocSidebarItems from '@theme/DocSidebarItems'
12-
import sidebars from '../../../../../sidebars';
12+
import { dropdownCategories } from '../../../Navbar/Content/MenuData';
1313

1414
function SecondaryMenuBackButton(props) {
15-
return (
16-
<button {...props} type="button" className="clean-btn navbar-sidebar__back">
17-
<Translate
18-
id="theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel"
19-
description="The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)">
20-
← Back to main menu
21-
</Translate>
22-
</button>
23-
);
15+
return (
16+
<button {...props} type="button" className="clean-btn navbar-sidebar__back">
17+
<Translate
18+
id="theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel"
19+
description="The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)">
20+
← Back to main menu
21+
</Translate>
22+
</button>
23+
);
2424
}
2525

2626
// The secondary menu slides from the right and shows the top nav items. This is a little unusual - we use this to show the drop down items
@@ -37,16 +37,16 @@ export default function NavbarMobileSidebarSecondaryMenu() {
3737
</div>
3838
</div>
3939
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list', styles.docsMobileMenuItems)}>
40-
<DocSidebarItems items={sidebars.dropdownCategories.map(item => ({
40+
<DocSidebarItems items={dropdownCategories.map(item => ({
4141
...item,
42-
label: (
42+
label: React.isValidElement(item.label) ? item.label : (
4343
<Translate id={`sidebar.dropdownCategories.category.${item.label}`}>
4444
{item.label}
4545
</Translate>
4646
),
4747
items: item.items?.map(subItem => ({
4848
...subItem,
49-
label: (
49+
label: React.isValidElement(subItem.label) ? subItem.label : (
5050
<Translate id={`sidebar.dropdownCategories.category.${item.label}.${subItem.label}`}>
5151
{subItem.label}
5252
</Translate>

0 commit comments

Comments
 (0)