x-cards.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
  2. <link rel="import" href="../../bower_components/neon-animation/neon-shared-element-animatable-behavior.html">
  3. <link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
  4. <link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  5. <dom-module id="x-cards">
  6. <template>
  7. <style>
  8. :host {
  9. display: block;
  10. overflow: hidden;
  11. }
  12. #placeholder {
  13. opacity: 0;
  14. background-color: grey;
  15. @apply(--layout-fit);
  16. }
  17. paper-icon-button {
  18. position: absolute;
  19. top: 16px;
  20. right: 16px;
  21. z-index: 2;
  22. color: #313131;
  23. }
  24. paper-icon-button:hover {
  25. color: #4285f4;
  26. }
  27. </style>
  28. <div id="placeholder"></div>
  29. <div id="container">
  30. <paper-icon-button id="btn" icon="chat:info-outline" on-tap="_switch"></paper-icon-button>
  31. <content select="div"></content>
  32. </div>
  33. </template>
  34. </dom-module>
  35. <script>
  36. (function() {
  37. Polymer({
  38. is: 'x-cards',
  39. behaviors: [
  40. Polymer.NeonSharedElementAnimatableBehavior
  41. ],
  42. properties: {
  43. animationConfig: {
  44. value: function() {
  45. return {
  46. 'entry': [{
  47. name: 'reverse-ripple-animation',
  48. id: 'reverse-ripple',
  49. toPage: this
  50. }],
  51. 'exit': [{
  52. name: 'fade-out-animation',
  53. node: this.$.container,
  54. timing: {
  55. delay: 150,
  56. duration: 0
  57. }
  58. }, {
  59. name: 'ripple-animation',
  60. id: 'ripple',
  61. fromPage: this
  62. }]
  63. };
  64. }
  65. },
  66. sharedElements: {
  67. value: function() {
  68. return {
  69. 'ripple': this.$.btn,
  70. 'reverse-ripple': this.$.btn
  71. };
  72. }
  73. }
  74. },
  75. _switch: function() {
  76. document.querySelector('#pages').select(1);
  77. }
  78. });
  79. })();
  80. </script>