chore: refactor

This commit is contained in:
Roman Hotsiy 2019-07-29 17:29:32 +03:00
parent 2f80394e3c
commit 2588160d7c
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
2 changed files with 4 additions and 3 deletions

View File

@ -53,7 +53,7 @@ export class Redoc extends React.Component<RedocProps> {
/>
)) ||
null}
<SideMenu menu={menu} menuToggle={options.menuToggle} />
<SideMenu menu={menu} />
</StickyResponsiveSidebar>
<ApiContentWrap className="api-content">
<ApiInfo store={store} />

View File

@ -2,6 +2,7 @@ import { observer } from 'mobx-react';
import * as React from 'react';
import { IMenuItem, MenuStore } from '../../services/MenuStore';
import { OptionsContext } from '../OptionsProvider';
import { MenuItems } from './MenuItems';
import { PerfectScrollbarWrap } from '../../common-elements/perfect-scrollbar';
@ -10,9 +11,9 @@ import { RedocAttribution } from './styled.elements';
@observer
export class SideMenu extends React.Component<{
menu: MenuStore;
menuToggle?: boolean;
className?: string;
}> {
static contextType = OptionsContext;
private _updateScroll?: () => void;
render() {
@ -36,7 +37,7 @@ export class SideMenu extends React.Component<{
}
activate = (item: IMenuItem) => {
if (item && item.active && this.props.menuToggle) {
if (item && item.active && this.context.menuToggle) {
return item.expanded ? item.collapse() : item.expand();
}