From 70f426c7ca6a85aeb52021ddc3c4fa53a3057add Mon Sep 17 00:00:00 2001 From: frankiefu Date: Thu, 24 Apr 2014 10:26:51 -0700 Subject: [PATCH] card slides up --- sampler-scaffold.css | 23 ++++++++++++++------ sampler-scaffold.html | 50 ++++++++++++++++++++++++++++++++++--------- sampler-section.html | 1 - 3 files changed, 56 insertions(+), 18 deletions(-) diff --git a/sampler-scaffold.css b/sampler-scaffold.css index b9c7f39..f0b2bf1 100644 --- a/sampler-scaffold.css +++ b/sampler-scaffold.css @@ -8,7 +8,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN */ #drawerPanel { - background-color: #eee; + background-color: #fafafa; } [drawer] { @@ -31,20 +31,25 @@ core-toolbar { background-color: #4F7DC9; } -.card { +#card { display: block; margin: 128px 60px 60px 100px; box-shadow: rgba(0, 0, 0, 0.14902) 0px 2px 4px, rgba(0, 0, 0, 0.14902) 0px 0px 3px; } -/*@polyfill .card > * */ -.card > ::content > * { +#card.transiting { + transition: 0.38s -webkit-transform ease-out; + transition: 0.38s transform ease-out; +} + +/*@polyfill #card > * */ +#card > ::content > * { display: none; background-color: #fff; } -/*@polyfill .card > .core-selected */ -.card > ::content > .core-selected { +/*@polyfill #card > .core-selected */ +#card > ::content > .core-selected { display: block; } @@ -52,7 +57,7 @@ core-toolbar { background-color: #fff; } -#drawerPanel[narrow] .card { +#drawerPanel[narrow] #card { margin: 0; box-shadow: none; } @@ -60,3 +65,7 @@ core-toolbar { #drawerPanel:not([narrow]) #menuButton { display: none; } + +.toolbar-label { + letter-spacing: 0.05em; +} diff --git a/sampler-scaffold.html b/sampler-scaffold.html index 0e92f40..143d3ea 100644 --- a/sampler-scaffold.html +++ b/sampler-scaffold.html @@ -28,28 +28,28 @@ - + - +
{{label}}
- + - + -
{{sampleName}}
+
{{sampleName.tag ? '<' + sampleName.tag + '>' : sampleName.name}}
- + @@ -64,22 +64,52 @@ Polymer('sampler-scaffold', { - selected: 0, - responsiveWidth: '800px', attached: function() { this.updateMenu(); + this.async(function() { + this.selected = 0; + }, null, 300); }, updateMenu: function() { this.sampleNames = []; Array.prototype.forEach.call(this.$.samples.getDistributedNodes(), function(sample) { - this.sampleNames.push(sample.getAttribute('label')); + this.sampleNames.push({ + name: sample.getAttribute('label'), + tag: sample.getAttribute('tag') + }); }.bind(this)); }, + selectedChanged: function() { + if (this.narrow) { + return; + } + this.$.card.classList.remove('transiting'); + this.$.card.style.display = 'none'; + this.async(function() { + this.$.card.style.display = 'block'; + this.moveCard(this.$.mainHeaderPanel.offsetHeight); + this.async(function() { + this.$.card.classList.add('transiting'); + this.moveCard(null); + }, null, 100); + }); + }, + + moveCard: function(y) { + var s = this.$.card.style; + s.webkitTransform = s.transform = + y ? 'translate3d(0, ' + y + 'px,0)' : null; + }, + + cardTransitingDone: function() { + this.$.card.classList.remove('transiting'); + }, + togglePanel: function() { this.$.drawerPanel.togglePanel(); } diff --git a/sampler-section.html b/sampler-section.html index e89d27d..3cad822 100644 --- a/sampler-section.html +++ b/sampler-section.html @@ -69,7 +69,6 @@ frameLoaded: function() { this.loaded = true; - this.updateFrameHeight(); this.frame.contentWindow.addEventListener('polymer-ready', function() { setTimeout(this.updateFrameHeight.bind(this), 100); }.bind(this));