mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-29 20:13: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}
|
null}
|
||||||
<SideMenu menu={menu} menuToggle={options.menuToggle} />
|
<SideMenu menu={menu} />
|
||||||
</StickyResponsiveSidebar>
|
</StickyResponsiveSidebar>
|
||||||
<ApiContentWrap className="api-content">
|
<ApiContentWrap className="api-content">
|
||||||
<ApiInfo store={store} />
|
<ApiInfo store={store} />
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { observer } from 'mobx-react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import { IMenuItem, MenuStore } from '../../services/MenuStore';
|
import { IMenuItem, MenuStore } from '../../services/MenuStore';
|
||||||
|
import { OptionsContext } from '../OptionsProvider';
|
||||||
import { MenuItems } from './MenuItems';
|
import { MenuItems } from './MenuItems';
|
||||||
|
|
||||||
import { PerfectScrollbarWrap } from '../../common-elements/perfect-scrollbar';
|
import { PerfectScrollbarWrap } from '../../common-elements/perfect-scrollbar';
|
||||||
|
@ -10,9 +11,9 @@ import { RedocAttribution } from './styled.elements';
|
||||||
@observer
|
@observer
|
||||||
export class SideMenu extends React.Component<{
|
export class SideMenu extends React.Component<{
|
||||||
menu: MenuStore;
|
menu: MenuStore;
|
||||||
menuToggle?: boolean;
|
|
||||||
className?: string;
|
className?: string;
|
||||||
}> {
|
}> {
|
||||||
|
static contextType = OptionsContext;
|
||||||
private _updateScroll?: () => void;
|
private _updateScroll?: () => void;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -36,7 +37,7 @@ export class SideMenu extends React.Component<{
|
||||||
}
|
}
|
||||||
|
|
||||||
activate = (item: IMenuItem) => {
|
activate = (item: IMenuItem) => {
|
||||||
if (item && item.active && this.props.menuToggle) {
|
if (item && item.active && this.context.menuToggle) {
|
||||||
return item.expanded ? item.collapse() : item.expand();
|
return item.expanded ? item.collapse() : item.expand();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user