fix(client): SideNav, if more than 1 child is expanded, only the first is shown, the rest disappear

This commit is contained in:
Valeriy S
2019-01-28 17:16:25 +03:00
committed by mrugesh mohapatra
parent c36ee82443
commit d13cb03810

View File

@ -74,17 +74,10 @@ class NavPanel extends Component {
renderBody() { renderBody() {
const { hasChildren, children, isExpanded } = this.props; const { hasChildren, children, isExpanded } = this.props;
const childrenWithChildren = children.filter(child => child.props.children);
const uniqueChildren = children.filter(
child =>
!childrenWithChildren.some(
(potentialDupe, index) => index > 0 && potentialDupe.key === child.key
)
);
return ( return (
<div className={isExpanded ? 'body' : ''}> <div className={isExpanded ? 'body' : ''}>
<ul className='navPanelUl'> <ul className='navPanelUl'>
{hasChildren ? uniqueChildren : <NoArticles />} {hasChildren ? children : <NoArticles />}
</ul> </ul>
</div> </div>
); );