React = require 'react' {Actions} = require 'nylas-exports' class NotificationsItem extends React.Component @displayName: "NotificationsItem" render: => notif = @props.notification iconClass = if notif.icon then "fa #{notif.icon}" else "" actionDefault = null actionComponents = notif.actions?.map (action) => classname = "action " if action.default actionDefault = action classname += "default" actionClick = (event) => @_fireItemAction(notif, action) event.stopPropagation() event.preventDefault() {action.label} if actionDefault
@_fireItemAction(notif, actionDefault)}>
{notif.message}
{actionComponents}
else
{notif.message}
{actionComponents}
_fireItemAction: (notification, action) => Actions.notificationActionTaken({notification, action}) module.exports = NotificationsItem