mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-08 06:04:56 +03:00
Yarn prettier
This commit is contained in:
parent
10c5662b64
commit
8a99f59ba5
|
@ -1,22 +1,19 @@
|
||||||
import {observer} from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {IMenuItem, MenuStore} from '../../services';
|
import { IMenuItem, MenuStore } from '../../services';
|
||||||
import {ContentItems} from './ContentItems';
|
import { ContentItems } from './ContentItems';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class SingleContentItem extends React.Component<{
|
export class SingleContentItem extends React.Component<{
|
||||||
menu: MenuStore;
|
menu: MenuStore;
|
||||||
}> {
|
}> {
|
||||||
|
|
||||||
extractActive(menu: MenuStore): IMenuItem[] {
|
extractActive(menu: MenuStore): IMenuItem[] {
|
||||||
const active = menu.flatItems[menu.activeItemIdx];
|
const active = menu.flatItems[menu.activeItemIdx];
|
||||||
if (!active) {
|
if (!active) {
|
||||||
return [menu.flatItems[0]];
|
return [menu.flatItems[0]];
|
||||||
}
|
}
|
||||||
if (active.type !== 'operation') {
|
if (active.type !== 'operation') {
|
||||||
return [
|
return [{ ...active, items: [] }];
|
||||||
{...active, items: []},
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
return [active];
|
return [active];
|
||||||
}
|
}
|
||||||
|
@ -24,8 +21,6 @@ export class SingleContentItem extends React.Component<{
|
||||||
render() {
|
render() {
|
||||||
const { menu } = this.props;
|
const { menu } = this.props;
|
||||||
const activeItems = this.extractActive(menu);
|
const activeItems = this.extractActive(menu);
|
||||||
return (
|
return <ContentItems items={activeItems as any} />;
|
||||||
<ContentItems items={activeItems as any} />
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as React from 'react';
|
||||||
import { ThemeProvider } from '../../styled-components';
|
import { ThemeProvider } from '../../styled-components';
|
||||||
import { OptionsProvider } from '../OptionsProvider';
|
import { OptionsProvider } from '../OptionsProvider';
|
||||||
|
|
||||||
import {AppStore} from '../../services';
|
import { AppStore } from '../../services';
|
||||||
import { ApiInfo } from '../ApiInfo/';
|
import { ApiInfo } from '../ApiInfo/';
|
||||||
import { ApiLogo } from '../ApiLogo/ApiLogo';
|
import { ApiLogo } from '../ApiLogo/ApiLogo';
|
||||||
import { ContentItems } from '../ContentItems/ContentItems';
|
import { ContentItems } from '../ContentItems/ContentItems';
|
||||||
|
@ -12,7 +12,7 @@ import { SideMenu } from '../SideMenu/SideMenu';
|
||||||
import { StickyResponsiveSidebar } from '../StickySidebar/StickyResponsiveSidebar';
|
import { StickyResponsiveSidebar } from '../StickySidebar/StickyResponsiveSidebar';
|
||||||
import { ApiContentWrap, BackgroundStub, RedocWrap } from './styled.elements';
|
import { ApiContentWrap, BackgroundStub, RedocWrap } from './styled.elements';
|
||||||
|
|
||||||
import {SingleContentItem} from '../ContentItems/SingleContentItem';
|
import { SingleContentItem } from '../ContentItems/SingleContentItem';
|
||||||
import { SearchBox } from '../SearchBox/SearchBox';
|
import { SearchBox } from '../SearchBox/SearchBox';
|
||||||
import { StoreProvider } from '../StoreBuilder';
|
import { StoreProvider } from '../StoreBuilder';
|
||||||
|
|
||||||
|
@ -58,10 +58,11 @@ export class Redoc extends React.Component<RedocProps> {
|
||||||
</StickyResponsiveSidebar>
|
</StickyResponsiveSidebar>
|
||||||
<ApiContentWrap className="api-content">
|
<ApiContentWrap className="api-content">
|
||||||
<ApiInfo store={store} />
|
<ApiInfo store={store} />
|
||||||
{options.disableInfiniteScroll
|
{options.disableInfiniteScroll ? (
|
||||||
? <SingleContentItem menu={menu}/>
|
<SingleContentItem menu={menu} />
|
||||||
: <ContentItems items={menu.items as any}/>
|
) : (
|
||||||
}
|
<ContentItems items={menu.items as any} />
|
||||||
|
)}
|
||||||
</ApiContentWrap>
|
</ApiContentWrap>
|
||||||
<BackgroundStub />
|
<BackgroundStub />
|
||||||
</RedocWrap>
|
</RedocWrap>
|
||||||
|
|
|
@ -387,7 +387,9 @@ describe('Utils', () => {
|
||||||
expect(pluralizeType('objects (Pet)')).toEqual('objects (Pet)');
|
expect(pluralizeType('objects (Pet)')).toEqual('objects (Pet)');
|
||||||
expect(pluralizeType('strings <email>')).toEqual('strings <email>');
|
expect(pluralizeType('strings <email>')).toEqual('strings <email>');
|
||||||
expect(pluralizeType('objects or strings')).toEqual('objects or strings');
|
expect(pluralizeType('objects or strings')).toEqual('objects or strings');
|
||||||
expect(pluralizeType('objects (Pet) or numbers <int64>')).toEqual('objects (Pet) or numbers <int64>');
|
expect(pluralizeType('objects (Pet) or numbers <int64>')).toEqual(
|
||||||
|
'objects (Pet) or numbers <int64>',
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user