1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Only show notification expand icon when there are > 1 notifications that 'shouldBeRendered' (#6965)

This commit is contained in:
Dan J Miller 2019-08-06 00:54:36 -02:30 committed by GitHub
parent 010e3927da
commit 3136dd39ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,21 +16,20 @@ export default class MultipleNotifications extends PureComponent {
const { showAll } = this.state const { showAll } = this.state
const { notifications, classNames = [] } = this.props const { notifications, classNames = [] } = this.props
const notificationsToBeRendered = notifications.filter(notificationConfig => notificationConfig.shouldBeRendered)
return (<div return (<div
className={classnames(...classNames, { className={classnames(...classNames, {
'home-notification-wrapper--show-all': showAll, 'home-notification-wrapper--show-all': showAll,
'home-notification-wrapper--show-first': !showAll, 'home-notification-wrapper--show-first': !showAll,
})} })}
> >
{notifications { notificationsToBeRendered.map(notificationConfig => notificationConfig.component) }
.filter(notificationConfig => notificationConfig.shouldBeRendered)
.map(notificationConfig => notificationConfig.component)
}
<div <div
className="home-notification-wrapper__i-container" className="home-notification-wrapper__i-container"
onClick={() => this.setState({ showAll: !showAll })} onClick={() => this.setState({ showAll: !showAll })}
> >
{notifications.length > 1 ? <i className={classnames('fa fa-sm fa-sort-amount-asc', { {notificationsToBeRendered.length > 1 ? <i className={classnames('fa fa-sm fa-sort-amount-asc', {
'flipped': !showAll, 'flipped': !showAll,
})} /> : null} })} /> : null}
</div> </div>