-
Notifications
You must be signed in to change notification settings - Fork 11
Adds renewable cards #5
base: master
Are you sure you want to change the base?
Conversation
Uses Polymer to provide a simple way for cards to smoothly animate back to the end of the list.
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/. If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits. Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name. |
demo.html
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might cool to express this behavior in the form of a Polymer element, rather than just a chunk of script. For example, a renewable-card-list or something similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea - there may also be a more elegant way of doing this anyway (e.g. without using setTimeout), so it's probably worth optimising the code in addition to creating a separate Polymer element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would +1 the idea of doing this via an element rather than in script. On the timeout, a 10s timeout for animations to complete seems rather arbitrary. Was there a particular reason this was approached this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're entirely right - the 10ms timeout is indeed arbitrary, chosen only as a small, non-zero number that still allowed the animation to proceed as expected. I arrived at 10 after a bit of testing with longer timeouts, but it could probably be 1, or done another way without timeouts altogether. I'll revisit as soon as I can.
script moved within the swipeable-cards element; ’removable’ and ‘renewable’ are now attributes; simplified demo page; timeout is 1ms. May want to look at creating a renewable-card-list as mentioned by cdata
|
CLAs look good, thanks! |
More similar to Google Now Cards behaviour
rather than an arbitrarily named ‘#cards’ deck
TODO: disableSwipe attribute not working yet
Users really need to be able to bring the cards back, not only just to discard them permanently, and they should come back smoothly and animate-in just as nicely as they animate-out. This pull-request uses Polymer to provide a simple way for cards to smoothly animate back to the end of the list (in this example, using when the swipeable-card id="renewable").