Mailspring/internal_packages/message-list/lib/thread-star-button.cjsx
Evan Morikawa b89fea38c0 feat(labels): add a new label/folder picker
Summary:
This is the initial diff for the label picker UI. This is all of the
functionality and none of the CSS.

Test Plan: todo

Reviewers: bengotow

Reviewed By: bengotow

Subscribers: sdw

Differential Revision: https://phab.nylas.com/D1761
2015-07-21 14:20:15 -07:00

32 lines
863 B
CoffeeScript

_ = require 'underscore'
React = require 'react'
{Actions, Utils, UpdateThreadsTask} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
class StarButton extends React.Component
@displayName: "StarButton"
@propTypes:
thread: React.PropTypes.object
render: =>
selected = @props.thread? and @props.thread.starred
<button className="btn btn-toolbar btn-star"
data-tooltip="Star"
onClick={@_onStarToggle}>
<RetinaImg name="toolbar-star.png" mode={RetinaImg.Mode.ContentIsMask} selected={selected} />
</button>
_onStarToggle: (e) =>
threads = [@props.thread]
if @props.thread.starred
values = starred: false
else
values = starred: true
task = new UpdateThreadsTask(threads, values)
Actions.queueTask(task)
e.stopPropagation()
module.exports = StarButton