aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-shared
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-10-02 05:26:06 +0800
committerFabio Berger <me@fabioberger.com>2018-10-02 05:26:06 +0800
commit3a9791e7943c5572d24b257217bfe1558beff5fc (patch)
tree3f306215a1346660d067696cd248ed6b4682b6fd /packages/react-shared
parent0d57ed6c933a8332253cf673a521dddcae601872 (diff)
downloaddexon-sol-tools-3a9791e7943c5572d24b257217bfe1558beff5fc.tar
dexon-sol-tools-3a9791e7943c5572d24b257217bfe1558beff5fc.tar.gz
dexon-sol-tools-3a9791e7943c5572d24b257217bfe1558beff5fc.tar.bz2
dexon-sol-tools-3a9791e7943c5572d24b257217bfe1558beff5fc.tar.lz
dexon-sol-tools-3a9791e7943c5572d24b257217bfe1558beff5fc.tar.xz
dexon-sol-tools-3a9791e7943c5572d24b257217bfe1558beff5fc.tar.zst
dexon-sol-tools-3a9791e7943c5572d24b257217bfe1558beff5fc.zip
Make menuSubsectionsBySection optional
Diffstat (limited to 'packages/react-shared')
-rw-r--r--packages/react-shared/src/components/nested_sidebar_menu.tsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx
index 14b233cd6..9933f3b38 100644
--- a/packages/react-shared/src/components/nested_sidebar_menu.tsx
+++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx
@@ -12,7 +12,7 @@ import { VersionDropDown } from './version_drop_down';
export interface NestedSidebarMenuProps {
topLevelMenu: { [topLevel: string]: string[] };
- menuSubsectionsBySection: MenuSubsectionsBySection;
+ menuSubsectionsBySection?: MenuSubsectionsBySection;
sidebarHeader?: React.ReactNode;
shouldDisplaySectionHeaders?: boolean;
onMenuItemClick?: () => void;
@@ -44,6 +44,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
shouldDisplaySectionHeaders: true,
onMenuItemClick: _.noop.bind(_),
shouldReformatMenuItemNames: true,
+ menuSubsectionsBySection: {},
};
public render(): React.ReactNode {
const navigation = _.map(this.props.topLevelMenu, (menuItems: string[], sectionName: string) => {
@@ -122,7 +123,10 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
return menuItems;
}
private _renderMenuItemSubsections(menuItemName: string): React.ReactNode {
- if (_.isUndefined(this.props.menuSubsectionsBySection[menuItemName])) {
+ if (
+ _.isUndefined(this.props.menuSubsectionsBySection) ||
+ _.isUndefined(this.props.menuSubsectionsBySection[menuItemName])
+ ) {
return null;
}
return this._renderMenuSubsectionsBySection(menuItemName, this.props.menuSubsectionsBySection[menuItemName]);