mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
29 lines
882 B
CoffeeScript
29 lines
882 B
CoffeeScript
_ = require 'underscore'
|
|
React = require 'react'
|
|
{Actions, TaskFactory, Utils} = require 'nylas-exports'
|
|
{RetinaImg} = require 'nylas-component-kit'
|
|
|
|
class StarButton extends React.Component
|
|
@displayName: "StarButton"
|
|
@containerRequired: false
|
|
@propTypes:
|
|
thread: React.PropTypes.object
|
|
|
|
render: =>
|
|
selected = @props.thread? and @props.thread.starred
|
|
<button className="btn btn-toolbar"
|
|
style={order: -104}
|
|
title={if selected then "Remove star" else "Add star"}
|
|
onClick={@_onStarToggle}>
|
|
<RetinaImg name="toolbar-star.png" mode={RetinaImg.Mode.ContentIsMask} selected={selected} />
|
|
</button>
|
|
|
|
_onStarToggle: (e) =>
|
|
Actions.queueTask(TaskFactory.taskForInvertingStarred({
|
|
source: "Toolbar Button: Message List",
|
|
threads: [@props.thread]
|
|
}))
|
|
e.stopPropagation()
|
|
|
|
|
|
module.exports = StarButton
|