mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-15 03:33:10 +08:00
27 lines
696 B
Text
27 lines
696 B
Text
|
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">{
|
||
|
for notification in @state.notifications
|
||
|
<div className={"notification-item notification-#{notification.type}"}>
|
||
|
{notification.message}
|
||
|
</div>
|
||
|
}</div>
|
||
|
|
||
|
_onStoreChange: ->
|
||
|
@setState
|
||
|
notifications: NotificationStore.notifications()
|