aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-shared
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-09-28 22:16:17 +0800
committerFabio Berger <me@fabioberger.com>2018-09-28 22:16:17 +0800
commit54f535b37547fe02e5c832fff9c9e82458d76649 (patch)
tree0a3f09205dae770606010402f2c1628b01a535d1 /packages/react-shared
parent155a4a8f067e36912c3eb6bc279ca58ce90a53c0 (diff)
downloaddexon-sol-tools-54f535b37547fe02e5c832fff9c9e82458d76649.tar
dexon-sol-tools-54f535b37547fe02e5c832fff9c9e82458d76649.tar.gz
dexon-sol-tools-54f535b37547fe02e5c832fff9c9e82458d76649.tar.bz2
dexon-sol-tools-54f535b37547fe02e5c832fff9c9e82458d76649.tar.lz
dexon-sol-tools-54f535b37547fe02e5c832fff9c9e82458d76649.tar.xz
dexon-sol-tools-54f535b37547fe02e5c832fff9c9e82458d76649.tar.zst
dexon-sol-tools-54f535b37547fe02e5c832fff9c9e82458d76649.zip
Add back ability to listen for menu click events from the sidebar
Diffstat (limited to 'packages/react-shared')
-rw-r--r--packages/react-shared/src/components/nested_sidebar_menu.tsx12
1 files changed, 11 insertions, 1 deletions
diff --git a/packages/react-shared/src/components/nested_sidebar_menu.tsx b/packages/react-shared/src/components/nested_sidebar_menu.tsx
index 3c61fb0b1..14b233cd6 100644
--- a/packages/react-shared/src/components/nested_sidebar_menu.tsx
+++ b/packages/react-shared/src/components/nested_sidebar_menu.tsx
@@ -101,7 +101,11 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
duration={constants.DOCS_SCROLL_DURATION_MS}
containerId={constants.DOCS_CONTAINER_ID}
>
- <MenuItem style={menuItemStyles} innerDivStyle={menuItemInnerDivStyles}>
+ <MenuItem
+ style={menuItemStyles}
+ innerDivStyle={menuItemInnerDivStyles}
+ onClick={this._onMenuItemClick.bind(this)}
+ >
<span
style={{
textTransform: this.props.shouldReformatMenuItemNames ? 'capitalize' : 'none',
@@ -145,6 +149,7 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
fontSize: 14,
lineHeight: '35px',
}}
+ onClick={this._onMenuItemClick.bind(this)}
>
{entityName}
</MenuItem>
@@ -155,4 +160,9 @@ export class NestedSidebarMenu extends React.Component<NestedSidebarMenuProps, N
</ul>
);
}
+ private _onMenuItemClick(): void {
+ if (!_.isUndefined(this.props.onMenuItemClick)) {
+ this.props.onMenuItemClick();
+ }
+ }
}