2017-09-09 16:38:18 +00:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2016-12-04 20:02:24 +00:00
|
|
|
|
|
|
|
class NotificationIcon extends Component {
|
2017-03-16 21:58:56 +00:00
|
|
|
|
|
|
|
static propTypes = {
|
2017-09-20 03:48:46 +00:00
|
|
|
unreadNotificationsCount: PropTypes.number,
|
|
|
|
toggleNotificationsBox: PropTypes.func
|
2016-12-04 20:02:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render = () => {
|
2017-09-20 03:48:46 +00:00
|
|
|
const { toggleNotificationsBox } = this.props
|
2016-12-11 22:29:48 +00:00
|
|
|
let linkClasses = 'notificationsIcon upperRightEl upperRightIcon '
|
2017-09-20 03:48:46 +00:00
|
|
|
linkClasses += 'ignore-react-onclickoutside '
|
2016-12-11 22:29:48 +00:00
|
|
|
|
2016-12-04 20:02:24 +00:00
|
|
|
if (this.props.unreadNotificationsCount > 0) {
|
2016-12-11 22:29:48 +00:00
|
|
|
linkClasses += 'unread'
|
2016-12-04 20:02:24 +00:00
|
|
|
} else {
|
2016-12-11 22:29:48 +00:00
|
|
|
linkClasses += 'read'
|
2016-12-04 20:02:24 +00:00
|
|
|
}
|
2016-12-11 22:29:48 +00:00
|
|
|
|
2016-12-04 20:02:24 +00:00
|
|
|
return (
|
2017-09-20 03:48:46 +00:00
|
|
|
<div className={linkClasses} onClick={toggleNotificationsBox}>
|
2016-12-04 20:02:24 +00:00
|
|
|
<div className="tooltipsUnder">
|
2016-12-12 21:07:34 +00:00
|
|
|
Notifications
|
2016-12-04 20:02:24 +00:00
|
|
|
</div>
|
|
|
|
{this.props.unreadNotificationsCount === 0 ? null : (
|
|
|
|
<div className="unread-notifications-dot"></div>
|
|
|
|
)}
|
2017-09-20 03:48:46 +00:00
|
|
|
</div>
|
2016-12-11 22:29:48 +00:00
|
|
|
|
2016-12-04 20:02:24 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default NotificationIcon
|