OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | |
3 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | |
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | |
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | |
6 Code distributed by Google as part of the polymer project is also | |
7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | |
8 --> | |
9 | |
10 <!-- | |
11 `core-scaffold` provides general application layout, introducing a | |
12 responsive scaffold containing a header, toolbar, menu, title and | |
13 areas for application content. | |
14 | |
15 Example: | |
16 | |
17 <core-scaffold> | |
18 <core-header-panel navigation flex mode="seamed"> | |
19 <core-toolbar>Application</core-toolbar> | |
20 <core-menu theme="core-light-theme"> | |
21 <core-item icon="settings" label="item1"></core-item> | |
22 <core-item icon="settings" label="item2"></core-item> | |
23 </core-menu> | |
24 </core-header-panel> | |
25 <div tool>Title</div> | |
26 <div>Content goes here...</div> | |
27 </core-scaffold> | |
28 | |
29 Use `mode` to control the header and scrolling behavior of `core-header-panel` | |
30 and `responsiveWidth` to change the layout of the scaffold. | |
31 | |
32 To have the content fits to the main area, use `fit` attribute. | |
33 | |
34 <core-scaffold> | |
35 <core-header-panel navigation flex mode="seamed"> | |
36 .... | |
37 </core-header-panel> | |
38 <div tool>Title</div> | |
39 <div fit>Content fits to the main area</div> | |
40 </core-scaffold> | |
41 | |
42 @group Polymer Core Elements | |
43 @element core-scaffold | |
44 @homepage github.io | |
45 --> | |
46 | |
47 <link rel="import" href="../core-toolbar/core-toolbar.html"> | |
48 <link rel="import" href="../core-drawer-panel/core-drawer-panel.html"> | |
49 <link rel="import" href="../core-header-panel/core-header-panel.html"> | |
50 <link rel="import" href="../core-icon-button/core-icon-button.html"> | |
51 | |
52 <polymer-element name="core-scaffold"> | |
53 <template> | |
54 | |
55 <style> | |
56 | |
57 :host { | |
58 display: block; | |
59 } | |
60 | |
61 [drawer] { | |
62 background-color: #fff; | |
63 box-shadow: 1px 0 1px rgba(0, 0, 0, 0.1); | |
64 } | |
65 | |
66 [main] { | |
67 height: 100%; | |
68 background-color: #eee; | |
69 } | |
70 | |
71 core-toolbar { | |
72 background-color: #526E9C; | |
73 color: #fff; | |
74 } | |
75 | |
76 #drawerPanel:not([narrow]) #menuButton { | |
77 display: none; | |
78 } | |
79 | |
80 </style> | |
81 | |
82 <core-drawer-panel id="drawerPanel" narrow="{{narrow}}" responsiveWidth="{{res
ponsiveWidth}}"> | |
83 | |
84 <div vertical layout drawer> | |
85 | |
86 <content select="[navigation], nav"></content> | |
87 | |
88 </div> | |
89 | |
90 <core-header-panel main mode="{{mode}}"> | |
91 | |
92 <core-toolbar> | |
93 <core-icon-button id="menuButton" icon="menu" on-tap="{{togglePanel}}"><
/core-icon-button> | |
94 <content select="[tool]"></content> | |
95 </core-toolbar> | |
96 | |
97 <content select="*"></content> | |
98 | |
99 </core-header-panel> | |
100 | |
101 </core-drawer-panel> | |
102 | |
103 </template> | |
104 <script> | |
105 | |
106 Polymer('core-scaffold', { | |
107 | |
108 publish: { | |
109 /** | |
110 * When the browser window size is smaller than the `responsiveWidth`, | |
111 * `core-drawer-panel` changes to a narrow layout. In narrow layout, | |
112 * the drawer will be stacked on top of the main panel. | |
113 * | |
114 * @attribute responsiveWidth | |
115 * @type string | |
116 * @default '600px' | |
117 */ | |
118 responsiveWidth: '600px', | |
119 | |
120 /** | |
121 * Used to control the header and scrolling behaviour of `core-header-pane
l` | |
122 * | |
123 * @attribute mode | |
124 * @type string | |
125 * @default 'seamed' | |
126 */ | |
127 mode: {value: 'seamed', reflect: true} | |
128 }, | |
129 | |
130 /** | |
131 * Toggle the drawer panel | |
132 * @method togglePanel | |
133 */ | |
134 togglePanel: function() { | |
135 this.$.drawerPanel.togglePanel(); | |
136 }, | |
137 | |
138 /** | |
139 * Open the drawer panel | |
140 * @method openDrawer | |
141 */ | |
142 openDrawer: function() { | |
143 this.$.drawerPanel.openDrawer(); | |
144 }, | |
145 | |
146 /** | |
147 * Close the drawer panel | |
148 * @method closeDrawer | |
149 */ | |
150 closeDrawer: function() { | |
151 this.$.drawerPanel.closeDrawer(); | |
152 } | |
153 | |
154 }); | |
155 | |
156 </script> | |
157 </polymer-element> | |
OLD | NEW |