From f63b7e66e44baea3c410a651b9f7c5831f07bbdd Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Fri, 19 Feb 2016 18:22:28 -0800 Subject: [PATCH] feat(swipe-to-*): Gesture support and animation in thread list 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 --- .../message-list/lib/thread-trash-button.cjsx | 2 +- .../thread-list/lib/thread-buttons.cjsx | 4 +- .../lib/thread-list-quick-actions.cjsx | 4 +- .../thread-list/lib/thread-list.cjsx | 19 +- .../thread-list/stylesheets/thread-list.less | 74 +++++++ spec/mailbox-perspective-spec.coffee | 66 +++--- src/browser/nylas-window.coffee | 6 + src/components/list-tabular-item.cjsx | 9 +- src/components/list-tabular.cjsx | 76 ++++++- src/components/multiselect-list.cjsx | 2 +- src/components/swipe-container.jsx | 209 ++++++++++++++++++ src/global/nylas-component-kit.coffee | 1 + src/mailbox-perspective.coffee | 41 ++-- src/window-event-handler.coffee | 6 + static/components/list-tabular.less | 4 + static/components/scroll-region.less | 1 + static/images/swipe/icon-swipe-archive@2x.png | Bin 0 -> 14663 bytes static/images/swipe/icon-swipe-snooze@2x.png | Bin 0 -> 15573 bytes static/images/swipe/icon-swipe-trash@2x.png | Bin 0 -> 15207 bytes 19 files changed, 453 insertions(+), 71 deletions(-) create mode 100644 src/components/swipe-container.jsx create mode 100644 static/images/swipe/icon-swipe-archive@2x.png create mode 100644 static/images/swipe/icon-swipe-snooze@2x.png create mode 100644 static/images/swipe/icon-swipe-trash@2x.png diff --git a/internal_packages/message-list/lib/thread-trash-button.cjsx b/internal_packages/message-list/lib/thread-trash-button.cjsx index ca575a9de..22bb56761 100644 --- a/internal_packages/message-list/lib/thread-trash-button.cjsx +++ b/internal_packages/message-list/lib/thread-trash-button.cjsx @@ -15,7 +15,7 @@ class ThreadTrashButton extends React.Component render: => focusedMailboxPerspective = FocusedPerspectiveStore.current() - return false unless focusedMailboxPerspective?.canTrashThreads() + return false unless focusedMailboxPerspective.canTrashThreads()