show shelf icon for groups if configuration option is set

This commit is contained in:
Patrick Rodacker 2019-03-19 14:09:41 +01:00
parent 3d0db68b3b
commit 2c4238c199

View File

@ -2,7 +2,7 @@ import { observer } from 'mobx-react';
import * as React from 'react'; import * as React from 'react';
import { ShelfIcon } from '../../common-elements/shelfs'; import { ShelfIcon } from '../../common-elements/shelfs';
import { IMenuItem, OperationModel } from '../../services'; import {GROUP_DEPTH, IMenuItem, OperationModel, RedocNormalizedOptions} from '../../services';
import { shortenHTTPVerb } from '../../utils/openapi'; import { shortenHTTPVerb } from '../../utils/openapi';
import { MenuItems } from './MenuItems'; import { MenuItems } from './MenuItems';
import { MenuItemLabel, MenuItemLi, MenuItemTitle, OperationBadge } from './styled.elements'; import { MenuItemLabel, MenuItemLi, MenuItemTitle, OperationBadge } from './styled.elements';
@ -11,6 +11,7 @@ export interface MenuItemProps {
item: IMenuItem; item: IMenuItem;
onActivate?: (item: IMenuItem) => void; onActivate?: (item: IMenuItem) => void;
withoutChildren?: boolean; withoutChildren?: boolean;
options: RedocNormalizedOptions;
} }
@observer @observer
@ -57,7 +58,7 @@ export class MenuItem extends React.Component<MenuItemProps> {
{item.name} {item.name}
{this.props.children} {this.props.children}
</MenuItemTitle> </MenuItemTitle>
{(item.depth > 0 && {((item.depth >= 0 || (item.depth === GROUP_DEPTH && this.props.options.collapseTagGroups)) &&
item.items.length > 0 && ( item.items.length > 0 && (
<ShelfIcon float={'right'} direction={item.expanded ? 'down' : 'right'} /> <ShelfIcon float={'right'} direction={item.expanded ? 'down' : 'right'} />
)) || )) ||