mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-26 10:33:44 +03:00
add an option for menu toggle
This commit is contained in:
parent
65ccebd9e2
commit
2f80394e3c
|
@ -53,7 +53,7 @@ export class Redoc extends React.Component<RedocProps> {
|
|||
/>
|
||||
)) ||
|
||||
null}
|
||||
<SideMenu menu={menu} />
|
||||
<SideMenu menu={menu} menuToggle={options.menuToggle} />
|
||||
</StickyResponsiveSidebar>
|
||||
<ApiContentWrap className="api-content">
|
||||
<ApiInfo store={store} />
|
||||
|
|
|
@ -8,7 +8,11 @@ import { PerfectScrollbarWrap } from '../../common-elements/perfect-scrollbar';
|
|||
import { RedocAttribution } from './styled.elements';
|
||||
|
||||
@observer
|
||||
export class SideMenu extends React.Component<{ menu: MenuStore; className?: string }> {
|
||||
export class SideMenu extends React.Component<{
|
||||
menu: MenuStore;
|
||||
menuToggle?: boolean;
|
||||
className?: string;
|
||||
}> {
|
||||
private _updateScroll?: () => void;
|
||||
|
||||
render() {
|
||||
|
@ -32,7 +36,7 @@ export class SideMenu extends React.Component<{ menu: MenuStore; className?: str
|
|||
}
|
||||
|
||||
activate = (item: IMenuItem) => {
|
||||
if (item && item.active) {
|
||||
if (item && item.active && this.props.menuToggle) {
|
||||
return item.expanded ? item.collapse() : item.expand();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ export interface RedocRawOptions {
|
|||
onlyRequiredInSamples?: boolean | string;
|
||||
showExtensions?: boolean | string | string[];
|
||||
hideSingleRequestSampleTab?: boolean | string;
|
||||
menuToggle?: boolean | string;
|
||||
|
||||
unstable_ignoreMimeParameters?: boolean;
|
||||
|
||||
|
@ -125,6 +126,7 @@ export class RedocNormalizedOptions {
|
|||
onlyRequiredInSamples: boolean;
|
||||
showExtensions: boolean | string[];
|
||||
hideSingleRequestSampleTab: boolean;
|
||||
menuToggle: boolean;
|
||||
|
||||
/* tslint:disable-next-line */
|
||||
unstable_ignoreMimeParameters: boolean;
|
||||
|
@ -156,6 +158,7 @@ export class RedocNormalizedOptions {
|
|||
this.onlyRequiredInSamples = argValueToBoolean(raw.onlyRequiredInSamples);
|
||||
this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(raw.showExtensions);
|
||||
this.hideSingleRequestSampleTab = argValueToBoolean(raw.hideSingleRequestSampleTab);
|
||||
this.menuToggle = argValueToBoolean(raw.menuToggle);
|
||||
|
||||
this.unstable_ignoreMimeParameters = argValueToBoolean(raw.unstable_ignoreMimeParameters);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user