mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-26 02:23:43 +03:00
chore: refactor
This commit is contained in:
parent
2f80394e3c
commit
2588160d7c
|
@ -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} />
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user