Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
contacts-v2: sidebar (no transitions)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yvonne Yip committed Oct 10, 2013
1 parent 159e8e7 commit 697d8d0
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
63 changes: 62 additions & 1 deletion shiny/Contacts-v2/components/contacts-app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<link href="../../../../polymer-elements/polymer-flex-layout/polymer-flex-layout.html" rel="import">
<link href="../../../../polymer-elements/polymer-grid-layout/polymer-grid-layout.html" rel="import">
<link href="../../../../polymer-ui-elements/polymer-ui-menu/polymer-ui-menu.html" rel="import">
<link href="../../../../polymer-ui-elements/polymer-ui-menu-item/polymer-ui-menu-item.html" rel="import">
<link href="../../../../polymer-ui-elements/polymer-ui-overlay/polymer-ui-overlay.html" rel="import">
<link href="../../../../polymer-ui-elements/polymer-ui-pages/polymer-ui-pages.html" rel="import">
<link href="contacts-create.html" rel="import">
<link href="contacts-detail.html" rel="import">
Expand All @@ -8,9 +12,38 @@
<polymer-element name="contacts-app" attribiutes="page selectedContact">
<template>
<style>
polymer-ui-menu {
padding: 0 !important;
}
.sidebar {
position: absolute;
top: 0;
left: 0;
bottom: 0;
background-color: white;
font-family: 'Helvetica Neue Medium', HelveticaNeue-Medium, Helvetica, sans-serif;
width: 80%;
max-width: 300px;
box-shadow: 5px 0px 5px rgba(50, 50, 50, 0.6);
}
.sidebar .header {
box-sizing: border-box;
height: 240px;
background: url('http://lorempixel.com/g/500/240/nature') repeat-x;
padding: 20px 20px 10px;
color: white;
}
.sidebar::x-overlay {
height: 100%;
}
.sidebar polymer-ui-menu-item {
margin: 10px;
color: black;
}
polymer-ui-pages {
display: block;
height: 100%;
z-index: 0;
}
.contactItem {
margin: 0 10px;
Expand All @@ -37,8 +70,25 @@
}
</style>
<mock-data id="mock"></mock-data>
<polymer-grid-layout id="grid"></polymer-grid-layout>
<polymer-ui-overlay id="sidebar" class="sidebar" backdrop modal>
<polymer-ui-menu valueattr="label" on-polymer-select="sidebarCloseAction">
<div class="header">
<polymer-flex-layout vertical></polymer-flex-layout>
<contacts-icon contact="{{me}}" large></contacts-icon>
<div flex></div>
<p>[email protected]</p>
</div>
<polymer-ui-menu-item label="Contacts" icon="contact"></polymer-ui-menu-item>
<polymer-ui-menu-item label="Groups" icon="stream"></polymer-ui-menu-item>
<polymer-ui-menu-item label="Favorites" icon="favorite"></polymer-ui-menu-item>
<polymer-ui-menu-item label="Settings" icon="settings"></polymer-ui-menu-item>
<polymer-ui-menu-item label="Import &amp; Export" icon="shortcut"></polymer-ui-menu-item>
<polymer-ui-menu-item label="Help" icon="dialog"></polymer-ui-menu-item>
</polymer-ui-menu>
</polymer-ui-overlay>
<polymer-ui-pages selected="{{page}}">
<contacts-list selectedModel="{{selectedContact}}" on-contacts-list-add="addContactAction">
<contacts-list selectedModel="{{selectedContact}}" on-contacts-list-add="addContactAction" on-contacts-menu-open="sidebarOpenAction">
<template repeat="{{alpha in $.mock.alphabetized}}">
<div class="contactItem header">
{{alpha.letter}}
Expand All @@ -62,6 +112,11 @@
Polymer('contacts-app', {
page: 0,
selectedContact: null,
ready: function() {
// this.$.grid.layout = [
// [2, 3, 3]
// ]
},
selectedContactChanged: function() {
console.log('selectedContact', this.selectedContact);
this.page = 1;
Expand All @@ -72,6 +127,12 @@
shrinkAction: function() {
this.page = 0;
},
sidebarOpenAction: function() {
this.$.sidebar.active = true;
},
sidebarCloseAction: function() {
this.$.sidebar.active = false;
},
contactCreateAction: function(e, detail, sender) {
this.selectedContact = detail;
}
Expand Down
5 changes: 4 additions & 1 deletion shiny/Contacts-v2/components/contacts-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</style>
<polymer-flex-layout vertical="true"></polymer-flex-layout>
<polymer-ui-toolbar>
<polymer-ui-icon-button icon="menu"></polymer-ui-icon-button>
<polymer-ui-icon-button icon="menu" on-tap="menuAction"></polymer-ui-icon-button>
<div flex>Contacts</div>
<polymer-ui-icon-button icon="plus" on-tap="addAction"></polymer-ui-icon-button>
<polymer-ui-icon-button icon="search"></polymer-ui-icon-button>
Expand All @@ -28,6 +28,9 @@
Polymer('contacts-list', {
addAction: function() {
this.fire('contacts-list-add');
},
menuAction: function() {
this.fire('contacts-menu-open');
}
})
</script>
Expand Down

0 comments on commit 697d8d0

Please sign in to comment.