Merge pull request #66 from google/fixes

Various fixes to improve UX, usability.
master
Addy Osmani 2014-06-18 11:30:27 +01:00
commit ef9807f1f9
3 changed files with 58 additions and 22 deletions

View File

@ -56,17 +56,20 @@
</header> </header>
<nav class="navdrawer-container promote-layer"> <nav class="navdrawer-container promote-layer">
<h4>Navigation</h4>
<ul> <ul>
<li><a href="#">Item 1</a></li> <li><a href="#hello">Hello</a></li>
<li><a href="#">Item 2</a></li> <li><a href="#get-started">Get Started</a></li>
<li><a href="#">Item 3</a></li> <li><a href="styleguide/index.html">Style Guide</a></li>
<li><a href="#">Item 4</a></li>
</ul> </ul>
</nav> </nav>
<main> <main>
<h1>Hello.</h1> <h1 id="hello">Hello!</h1>
<p>Welcome to Web Starter Kit. Read how to <a href="http://developers.google.com/web/starter-kit">Get Started</a> or check out the <a href="styleguide/index.html">Style Guide</a>.</p> <p>Welcome to Web Starter Kit.</p>
<h2 id="get-started">Get Started.</h2>
<p>Read how to <a href="http://developers.google.com/web/starter-kit">Get Started</a> or check out the <a href="styleguide/index.html">Style Guide</a>.</p>
</main> </main>
<!-- build:js scripts/main.min.js --> <!-- build:js scripts/main.min.js -->

View File

@ -18,18 +18,28 @@
*/ */
(function () { (function () {
'use strict'; 'use strict';
var navdrawerContainer = document.querySelector('.navdrawer-container'); var navdrawerContainer = document.querySelector('.navdrawer-container');
var appbarElement = document.querySelector('.app-bar'); var appbarElement = document.querySelector('.app-bar');
var menuBtn = document.querySelector('.menu'); var menuBtn = document.querySelector('.menu');
var main = document.querySelector('main');
menuBtn.addEventListener('click', function () { function closeMenu() {
var isOpen = navdrawerContainer.classList.contains('open'); appbarElement.classList.remove('open');
if (isOpen) { navdrawerContainer.classList.remove('open');
appbarElement.classList.remove('open'); }
navdrawerContainer.classList.remove('open');
} else { function toggleMenu() {
appbarElement.classList.add('open'); appbarElement.classList.toggle('open');
navdrawerContainer.classList.add('open'); navdrawerContainer.classList.toggle('open');
}
main.addEventListener('ontouchstart', closeMenu);
main.addEventListener('click', closeMenu);
menuBtn.addEventListener('click', toggleMenu);
navdrawerContainer.addEventListener('click', function (event) {
if (event.target.nodeName === 'A' || event.target.nodeName === 'LI') {
closeMenu();
} }
}, true); });
})(); })();

View File

@ -47,7 +47,8 @@ body {
margin: 0 auto; margin: 0 auto;
} }
.app-bar.open { .app-bar.open,
.app-bar.open ~ main {
-webkit-transform: translate(250px, 0); -webkit-transform: translate(250px, 0);
transform: translate(250px, 0); transform: translate(250px, 0);
} }
@ -133,15 +134,22 @@ button.menu img {
backface-visibility: hidden; backface-visibility: hidden;
} }
.base, p, ul, ol {
font-size: 19px;
}
.navdrawer-container { .navdrawer-container {
z-index: 1;
position: fixed; position: fixed;
top: 0;
bottom: 0;
width: 250px; width: 250px;
height: 100%; height: 100%;
background-color: #3367D6; background-color: #3367D6;
color: #fefefe; color: #fefefe;
-webkit-transform: translate(-250px, 0); -webkit-transform: translate(-250px, 0);
transform: translate(-250px, 0); transform: translate(-250px, 0);
z-index: 1; overflow-y: scroll;
} }
.navdrawer-container.open { .navdrawer-container.open {
@ -149,11 +157,23 @@ button.menu img {
transform: translate(0, 0); transform: translate(0, 0);
} }
.app-bar, .navdrawer-container { .app-bar, .navdrawer-container, main {
-webkit-transition: -webkit-transform 0.3s ease-out; -webkit-transition: -webkit-transform 0.3s ease-out;
transition: transform 0.3s ease-out; transition: transform 0.3s ease-out;
} }
.navdrawer-container h4,
.navdrawer-container ul li a {
height: 60px;
padding: 0 20px;
line-height: 60px;
}
.navdrawer-container h4 {
background-color: white;
color: #3367D6;
}
.navdrawer-container ul { .navdrawer-container ul {
padding: 0; padding: 0;
margin: 0; margin: 0;
@ -162,9 +182,6 @@ button.menu img {
.navdrawer-container ul li a { .navdrawer-container ul li a {
display: block; display: block;
height: 60px;
padding: 0 20px;
line-height: 60px;
text-decoration: none; text-decoration: none;
color: white; color: white;
-webkit-transition: background-color 0.2s ease-out; -webkit-transition: background-color 0.2s ease-out;
@ -199,6 +216,7 @@ main {
margin: 0 auto; margin: 0 auto;
/* Height of the header */ /* Height of the header */
padding: 60px 16px 16px 16px; padding: 60px 16px 16px 16px;
min-height: 100%;
} }
/** Larger Screens - desktops and tablets **/ /** Larger Screens - desktops and tablets **/
@ -256,6 +274,10 @@ main {
transition: none; transition: none;
} }
.navdrawer-container h4 {
display: none;
}
.navdrawer-container ul { .navdrawer-container ul {
display: -ms-flexbox; display: -ms-flexbox;
display: -webkit-flex; display: -webkit-flex;
@ -274,6 +296,7 @@ main {
main { main {
max-width: 864px; max-width: 864px;
padding-top: 0; padding-top: 0;
min-height: initial;
} }
body { body {
@ -304,7 +327,7 @@ main {
} }
.navdrawer-container { .navdrawer-container {
padding: 0 16px 8px 16px; padding: 0 16px;
} }
.navdrawer-container li { .navdrawer-container li {