mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 21:57:55 +08:00
c059b51fe3
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
44 lines
1.2 KiB
CoffeeScript
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
|