mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-06 16:25:52 +08:00
31 lines
809 B
CoffeeScript
31 lines
809 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">
|
|
<div className="inner">
|
|
{@_notificationComponents()}
|
|
</div>
|
|
</div>
|
|
|
|
_notificationComponents: ->
|
|
@state.notifications.map (notification) ->
|
|
<div className={"notification-item notification-#{notification.type}"}>
|
|
{notification.message}
|
|
</div>
|
|
|
|
_onStoreChange: ->
|
|
@setState
|
|
notifications: NotificationStore.notifications()
|