mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 12:40:08 +08:00
f63b7e66e4
Summary: This diff does two things: - It adds a new SwipeContainer that makes it easy to implement swipe gestures. This is built into listTabular, so you can create a list and define onSwipeLeft/Right to enable gestures. - It adds support for basic add/remove animations to the thread list. This works by adding a CSS transition to `top` and also leaving removed rows around for a specified time. (these times need to match.) Pretty much just cloned the core idea from TimeoutTransitionGroup. Test Plan: No tests yet Reviewers: evan, juan Reviewed By: evan Differential Revision: https://phab.nylas.com/D2581
37 lines
1 KiB
CoffeeScript
37 lines
1 KiB
CoffeeScript
_ = require 'underscore'
|
|
React = require 'react'
|
|
{Actions,
|
|
DOMUtils,
|
|
TaskFactory,
|
|
FocusedPerspectiveStore} = require 'nylas-exports'
|
|
{RetinaImg} = require 'nylas-component-kit'
|
|
|
|
class ThreadTrashButton extends React.Component
|
|
@displayName: "ThreadTrashButton"
|
|
@containerRequired: false
|
|
|
|
@propTypes:
|
|
thread: React.PropTypes.object.isRequired
|
|
|
|
render: =>
|
|
focusedMailboxPerspective = FocusedPerspectiveStore.current()
|
|
return false unless focusedMailboxPerspective.canTrashThreads()
|
|
|
|
<button className="btn btn-toolbar"
|
|
style={order: -106}
|
|
title="Move to Trash"
|
|
onClick={@_onRemove}>
|
|
<RetinaImg name="toolbar-trash.png" mode={RetinaImg.Mode.ContentIsMask}/>
|
|
</button>
|
|
|
|
_onRemove: (e) =>
|
|
return unless DOMUtils.nodeIsVisible(e.currentTarget)
|
|
tasks = TaskFactory.tasksForMovingToTrash
|
|
threads: [@props.thread],
|
|
fromPerspective: FocusedPerspectiveStore.current()
|
|
Actions.queueTasks(tasks)
|
|
Actions.popSheet()
|
|
e.stopPropagation()
|
|
|
|
|
|
module.exports = ThreadTrashButton
|