Only show Additional custom tabs if they exist
This commit is contained in:
parent
a05fd9c48d
commit
d6915ce661
|
@ -32,38 +32,35 @@ export class DetailsSection extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mapCustomMenuItems (customTabs) {
|
|
||||||
return customTabs.map(tab => {
|
|
||||||
return tab.name;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
displayMenu () {
|
displayMenu () {
|
||||||
const { details } = this.props;
|
const { details } = this.props;
|
||||||
|
|
||||||
let additionalMenu = (
|
let additionalMenu = null
|
||||||
<div>
|
if (details.hasOwnProperty('custom') && details.custom.length > 0) {
|
||||||
<p className='menu-label'>
|
additionalMenu = (
|
||||||
Additional
|
<div>
|
||||||
</p>
|
<p className='menu-label'>
|
||||||
<ul className='menu-list'>
|
Additional
|
||||||
{
|
</p>
|
||||||
details.custom.map((tab, index) => {
|
<ul className='menu-list'>
|
||||||
const tabId = index + this.defaultMenuItems.length;
|
{
|
||||||
return (
|
details.custom.map((tab, index) => {
|
||||||
<li key={ `customTab_${ tabId }_${ Date.now().toString() }` }>
|
const tabId = index + this.defaultMenuItems.length;
|
||||||
<a className={(this.state.currentDisplay === tabId) ? 'is-active' : null}
|
return (
|
||||||
onClick={ () => this.setState({ currentDisplay: tabId }) }
|
<li key={ `customTab_${ tabId }_${ Date.now().toString() }` }>
|
||||||
>
|
<a className={(this.state.currentDisplay === tabId) ? 'is-active' : null}
|
||||||
{ tab.name }
|
onClick={ () => this.setState({ currentDisplay: tabId }) }
|
||||||
</a>
|
>
|
||||||
</li>
|
{ tab.name }
|
||||||
);
|
</a>
|
||||||
})
|
</li>
|
||||||
}
|
);
|
||||||
</ul>
|
})
|
||||||
</div>
|
}
|
||||||
);
|
</ul>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='details-menu'>
|
<div className='details-menu'>
|
||||||
|
|
Loading…
Reference in New Issue