-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Changes from 11 commits
308a4d6
d4ab6a1
8829dc3
79958fc
e96e8f5
472d678
faff808
e50529c
e477c9e
b965678
18b5d4c
dc4049c
9778668
5b47a3f
ecfe982
61a8519
a9723b4
d6d4e46
ded552c
7083bbc
bff6e07
68323ca
95c7125
ca70eb4
9e437f2
b0a46dc
3388a58
fd75203
bdf2023
09a8d2f
34735fe
8659a6f
87b329d
af14a82
dac8de5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think the |
||
<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"></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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Load /assets/common.js above this line, to automatically get preventDefault on |
||
<script type="text/javascript"> | ||
demoReady(function() { | ||
var appBarElement = document.getElementById('demo-top-app-bar'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Shorten to |
||
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> |
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"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reference |
||
.demo-paragraph { | ||
padding: 16px; | ||
} | ||
} | ||
|
||
.demo-controls-container { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,7 @@ | |
"text-field", | ||
"theme", | ||
"toolbar", | ||
"top-app-bar", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about closure whitelist? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||
|
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.
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.)