Mailspring/internal_packages/thread-list/lib/draft-list-sidebar-item.cjsx
dillon c059b51fe3 fix(account-sidebar): make folder and label names wrap elegantly. fixes T3402.
Summary:
WIP: changing the rest of items to make them look correct

fix last draft item in sidebar

add more padding

Test Plan: tested manually. all tests remain green.

Reviewers: evan, bengotow

Reviewed By: bengotow

Maniphest Tasks: T3402

Differential Revision: https://phab.nylas.com/D1943
2015-08-31 10:47:25 -07:00

44 lines
1.2 KiB
CoffeeScript

React = require 'react'
_ = require 'underscore'
classNames = require 'classnames'
{Actions, Utils, WorkspaceStore, DraftCountStore} = require 'nylas-exports'
{RetinaImg} = require 'nylas-component-kit'
class DraftListSidebarItem extends React.Component
@displayName: 'DraftListSidebarItem'
constructor: (@props) ->
@state = @getStateFromStores()
componentDidMount: =>
@unsubscribe = DraftCountStore.listen(@_onCountChanged)
componentWillUnmount: =>
@unsubscribe()
getStateFromStores: =>
count: DraftCountStore.count()
_onCountChanged: =>
@setState(@getStateFromStores())
render: =>
classSet = classNames
'item': true
'selected': @props.select
unread = []
if @state.count > 0
unread = <div className="unread item-count-box">{@state.count}</div>
<div className={classSet} onClick={@_onClick}>
<div className="icon"><RetinaImg name={'drafts.png'} mode={RetinaImg.Mode.ContentIsMask} /></div>
<div className="name"> {@props.item.name}</div>
{unread}
</div>
_onClick: (event) =>
event.preventDefault()
Actions.selectRootSheet(@props.item)
module.exports = DraftListSidebarItem