Mailspring/internal_packages/notifications/lib/notifications.cjsx
Evan Morikawa 8b2797d3b0 feat(notifications): move to sidebar
Summary: feat(notifications): move to sidebar

Test Plan: edgehill --test

Reviewers: bengotow

Reviewed By: bengotow

Differential Revision: https://review.inboxapp.com/D1282
2015-03-11 13:17:11 -07:00

31 lines
797 B
CoffeeScript

React = require 'react'
NotificationStore = require './notifications-store'
module.exports =
Notifications = React.createClass
getInitialState: ->
notifications: NotificationStore.notifications()
componentDidMount: ->
@unsubscribeStore = NotificationStore.listen @_onStoreChange
componentWillUnmount: ->
@unsubscribeStore() if @unsubscribeStore
render: ->
<div className="notifications-momentary">
{@_notificationComponents()}
</div>
_notificationComponents: ->
@state.notifications.map (notification) ->
<div key={notification.id}
className={"notification-item notification-#{notification.type}"}>
{notification.message}
</div>
_onStoreChange: ->
@setState
notifications: NotificationStore.notifications()