Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(top-app-bar): Add top app bar component #2225

Merged
merged 35 commits into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
308a4d6
feat(top-app-bar): Initial component
williamernest Feb 10, 2018
d4ab6a1
feat(top-app-bar): Remove package-lock.json
williamernest Feb 12, 2018
8829dc3
feat(top-app-bar): Update test
williamernest Feb 12, 2018
79958fc
feat(top-app-bar): Add icon states
williamernest Feb 12, 2018
e96e8f5
Merge branch 'master' into feat/top-app-bar/new-component
williamernest Feb 12, 2018
472d678
feat(top-app-bar): Remove unused styles/file
williamernest Feb 12, 2018
faff808
feat(top-app-bar): Update demo top item of drawer to be back button
williamernest Feb 12, 2018
e50529c
feat(top-app-bar): Add mobile default styles
williamernest Feb 12, 2018
e477c9e
Merge branch 'master' into feat/top-app-bar/new-component
williamernest Feb 13, 2018
b965678
feat(top-app-bar): Clean up Component initialize function
williamernest Feb 14, 2018
18b5d4c
feat(top-app-bar): Merge master
williamernest Feb 14, 2018
dc4049c
feat(top-app-bar): Update for comments
williamernest Feb 14, 2018
9778668
temp
williamernest Feb 15, 2018
5b47a3f
WIP: Work on closure
williamernest Feb 15, 2018
ecfe982
feat(top-app-bar): Update for closure
williamernest Feb 15, 2018
61a8519
feat(top-app-bar): Fix closure
williamernest Feb 15, 2018
a9723b4
Merge branch 'master' into feat/top-app-bar/new-component
williamernest Feb 15, 2018
d6d4e46
feat(top-app-bar): Fix for lint
williamernest Feb 15, 2018
ded552c
Merge master
williamernest Feb 16, 2018
7083bbc
feat(top-app-bar): Resolve comments
williamernest Feb 16, 2018
bff6e07
feat(top-app-bar): Update for comments
williamernest Feb 16, 2018
68323ca
feat(top-app-bar): Update demo
williamernest Feb 16, 2018
95c7125
feat(top-app-bar): Update for comments
williamernest Feb 16, 2018
ca70eb4
feat(top-app-bar): Consolidate for strings test
williamernest Feb 16, 2018
9e437f2
feat(top-app-bar): Remove blank line
williamernest Feb 16, 2018
b0a46dc
Merge branch 'master' into feat/top-app-bar/new-component
williamernest Feb 20, 2018
3388a58
feat(top-app-bar): Update for comments
williamernest Feb 21, 2018
fd75203
Merge branch 'master' into feat/top-app-bar/new-component
williamernest Feb 21, 2018
bdf2023
feat(top-app-bar): Update deps for release
williamernest Feb 21, 2018
09a8d2f
feat(top-app-bar): Add outline none to icons
williamernest Feb 21, 2018
34735fe
feat(top-app-bar): Add height/width to icons to prevent race condition
williamernest Feb 21, 2018
8659a6f
feat(top-app-bar): Resolve comments
williamernest Feb 21, 2018
87b329d
feat(top-app-bar): Update tests
williamernest Feb 21, 2018
af14a82
Merge branch 'master' into feat/top-app-bar/new-component
williamernest Feb 21, 2018
dac8de5
feat(top-app-bar): Update test description
williamernest Feb 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@
</span>
</a>

<a href="top-app-bar.html" role="listitem" class="mdc-list-item">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p comes after o, so this should be after Toolbar if we're being consistent with alpha order.

OTOH I talked with Will about potential for confusion by adding this alongside toolbar before there are features implemented that differentiate it (and before we eventually relegate the toolbar package for different functionality...) and maybe we just shouldn't add this to the demo page until the distinguishing features are added? (So maybe we shouldn't add front-matter to the readme for the site yet either.)

<span class="demo-catalog-list-icon mdc-list-item__graphic"><img src="/images/ic_toolbar_24px.svg" /></span>
<span class="mdc-list-item__text">
Top App Bar
<span class="mdc-list-item__secondary-text">Headers</span>
</span>
</a>

<a href="toolbar/index.html" role="listitem" class="mdc-list-item">
<span class="demo-catalog-list-icon mdc-list-item__graphic"><img src="/images/ic_toolbar_24px.svg" /></span>
<span class="mdc-list-item__text">
Expand Down
125 changes: 125 additions & 0 deletions demos/top-app-bar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<!DOCTYPE html>
<!--
Copyright 2016 Google Inc. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License
-->
<html>
<head>
<meta charset="utf-8">
<title>MDC Top App Bar Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/images/logo_components_color_2x_web_48dp.png">
<link rel="stylesheet" href="/assets/top-app-bar.css">
<link rel="stylesheet" href="/assets/drawer/drawer.css">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how I feel about this vs. importing mdc-drawer in the top-app-bar demo scss. Including this instead also picks up a bunch of demo styles specific to the drawer page that aren't being used here.

<script src="/ready.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Mono">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
</head>
<body class="mdc-typography">
<header id="demo-top-app-bar" class="mdc-top-app-bar demo-top-app-bar">
<div class="mdc-top-app-bar__row">
<section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-start">
<a href="#" class="material-icons mdc-top-app-bar__menu-icon">menu</a>
<span class="mdc-top-app-bar__title">Title</span>
</section>
<section id="iconSection" class="mdc-top-app-bar__section mdc-top-app-bar__section--align-end" role="top-app-bar">
<a href="#" class="material-icons mdc-top-app-bar__icon" aria-label="Download" alt="Download">file_download</a>
<a href="#" class="material-icons mdc-top-app-bar__icon" aria-label="Print this page" alt="Print this page">print</a>
<a href="#" class="material-icons mdc-top-app-bar__icon" aria-label="Bookmark this page" alt="Bookmark this page">bookmark</a>
</section>
</div>
</header>

<aside class="mdc-drawer mdc-drawer--temporary demo-drawer">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the demo-drawer and demo-drawer-list-item classes are being styled at all in this demo page.

<nav class="mdc-drawer__drawer">
<header class="mdc-drawer__header">
<div class="mdc-drawer__header-content mdc-theme--text-primary-on-primary mdc-theme--primary-bg">
Header here
</div>
</header>
<nav class="mdc-drawer__content mdc-list-group">
<div id="icon-with-text-demo" class="mdc-list">
<a href="/" class="mdc-list-item demo-drawer-list-item">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">&#xE5C4;</i>Back
</a>
<a class="mdc-list-item demo-drawer-list-item" href="#">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">star</i>Star
</a>
<a class="mdc-list-item demo-drawer-list-item" href="#">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">send</i>Sent Mail
</a>
<a class="mdc-list-item demo-drawer-list-item" href="#">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">drafts</i>Drafts
</a>
</div>

<hr class="mdc-list-divider">

<div class="mdc-list">
<a class="mdc-list-item demo-drawer-list-item" href="#">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">email</i>All Mail
</a>
<a class="mdc-list-item demo-drawer-list-item" href="#">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">delete</i>Trash
</a>
<a class="mdc-list-item demo-drawer-list-item" href="#">
<i class="material-icons mdc-list-item__graphic" aria-hidden="true">report</i>Spam
</a>
</div>
</nav>
</nav>
</aside>

<main>
<div id="demo-content">
<p class="demo-paragraph">
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
</p>
<p class="demo-paragraph">
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
</p>
<p class="demo-paragraph">
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
</p>
<p class="demo-paragraph">
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
</p>
<p class="demo-paragraph">
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
</p>
<p class="demo-paragraph">
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est.
</p>
</div>
</main>

<script src="/assets/material-components-web.js" async></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Load /assets/common.js above this line, to automatically get preventDefault on a elements (to avoid the browser navigating to #)

<script type="text/javascript">
demoReady(function() {
var appBarElement = document.getElementById('demo-top-app-bar');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Shorten to appBarEl to match drawerEl?

var appBar = mdc.topAppBar.MDCTopAppBar.attachTo(appBarElement);

var drawerEl = document.querySelector('.mdc-drawer');
var MDCTemporaryDrawer = mdc.drawer.MDCTemporaryDrawer;
var drawer = new MDCTemporaryDrawer(drawerEl);

appBarElement.addEventListener('MDCTopAppBar:nav', function() {
drawer.open = true;
});

});
</script>
</body>
</html>
43 changes: 43 additions & 0 deletions demos/top-app-bar.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

@import "common";
@import "../packages/mdc-button/mdc-button";
@import "../packages/mdc-list/mdc-list";
@import "../packages/mdc-menu/mdc-menu";
@import "../packages/mdc-theme/color-palette";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import?

@import "../packages/mdc-top-app-bar/mdc-top-app-bar";

.demo-paragraph {
margin: 0;
padding: 20px 28px;
}

@media (max-width: 599px) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference $mdc-top-app-bar-mobile-breakpoint ?

.demo-paragraph {
padding: 16px;
}
}

.demo-controls-container {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this used anywhere?

@include mdc-elevation(4);
position: fixed;
bottom: 0;
right: 0;
background-color: white;
padding: 10px;
}

74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
"text-field",
"theme",
"toolbar",
"top-app-bar",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about closure whitelist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toolbar doesn't currently exist in closure whitelist, so I didn't add this one either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think any component we are writing from scratch should aim to be in the whitelist at the get-go at this point, because it's easier to deal with incrementally than having to come back through and clean up later.

"typography",
"demos",
"infrastructure",
Expand Down
3 changes: 3 additions & 0 deletions packages/material-components-web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import * as snackbar from '@material/snackbar/index';
import * as tabs from '@material/tabs/index';
import * as textField from '@material/textfield/index';
import * as toolbar from '@material/toolbar/index';
import * as topAppBar from '@material/top-app-bar/index';

// Register all components
autoInit.register('MDCLineRipple', lineRipple.MDCLineRipple);
Expand All @@ -58,6 +59,7 @@ autoInit.register('MDCMenu', menu.MDCMenu);
autoInit.register('MDCSelect', select.MDCSelect);
autoInit.register('MDCSlider', slider.MDCSlider);
autoInit.register('MDCToolbar', toolbar.MDCToolbar);
autoInit.register('MDCTopAppBar', topAppBar.MDCTopAppBar);

// Export all components.
export {
Expand All @@ -82,4 +84,5 @@ export {
tabs,
textField,
toolbar,
topAppBar,
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
@import "@material/textfield/mdc-text-field";
@import "@material/theme/mdc-theme";
@import "@material/toolbar/mdc-toolbar";
@import "@material/top-app-bar/mdc-top-app-bar";
@import "@material/typography/mdc-typography";
1 change: 1 addition & 0 deletions packages/material-components-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@material/textfield": "^0.30.0",
"@material/theme": "^0.30.0",
"@material/toolbar": "^0.30.0",
"@material/top-app-bar": "^0.0.0",
"@material/typography": "^0.28.0"
}
}
Loading