|
34 | 34 | .demo-grid lavu-grid:first-of-type lavu-cell { |
35 | 35 | height: 50px; |
36 | 36 | } |
| 37 | + .demo-grid lavu-grid:nth-child(even) lavu-cell { |
| 38 | + background-color: #CBCBCB; |
| 39 | + } |
37 | 40 | </style> |
38 | 41 |
|
39 | 42 | </head> |
40 | 43 | <body unresolved> |
41 | 44 |
|
42 | | - <h2>Some examples of <code><lavu-grid></code>:</h2> |
| 45 | + <h2>Examples of <code><lavu-grid></code>:</h2> |
43 | 46 | <div class="demo-grid"> |
44 | 47 | <lavu-grid> |
45 | 48 | <lavu-cell span="1">1</lavu-cell> |
@@ -152,50 +155,125 @@ <h2>Some examples of <code><lavu-grid></code>:</h2> |
152 | 155 | </div> |
153 | 156 |
|
154 | 157 |
|
155 | | -<h3>Nested grid with listener</h3> |
| 158 | +<div style="margin: 16px 8px 0 8px;"> |
| 159 | +<p>Nested grid demo</p> |
156 | 160 |
|
157 | | -<div style="margin: 8px 8px 0 8px;"> |
158 | | -<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:0;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #1e90ff; font-weight: bold"><lavu-grid</span> <span style="color: #FF0000; background-color: #FFAAAA">no-spacing</span> <span style="color: #1e90ff">on-media-query-changed=</span><span style="color: #aa5500">'_mediaQueryChanged'</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"outer"</span><span style="color: #1e90ff; font-weight: bold">></span> |
159 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"6"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"cornflower-blue"</span><span style="color: #1e90ff; font-weight: bold">></span> |
160 | | - <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-1"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
161 | | - <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
162 | 161 |
|
163 | | - <span style="color: #1e90ff; font-weight: bold"><template</span> <span style="color: #1e90ff">is=</span><span style="color: #aa5500">"dom-if"</span> <span style="color: #1e90ff">if=</span><span style="color: #aa5500">"{{!_isScreenMd}}"</span><span style="color: #1e90ff; font-weight: bold">></span> |
164 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"7"</span><span style="color: #1e90ff; font-weight: bold">></span> |
165 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-grid</span> <span style="color: #FF0000; background-color: #FFAAAA">no-spacing</span><span style="color: #1e90ff; font-weight: bold">></span> |
166 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-sm=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"golden-rod"</span><span style="color: #1e90ff; font-weight: bold">></span> |
167 | | - <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
| 162 | +<!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:0;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #1e90ff; font-weight: bold"><link</span> <span style="color: #1e90ff">rel=</span><span style="color: #aa5500">"import"</span> <span style="color: #1e90ff">href=</span><span style="color: #aa5500">"../../polymer/polymer.html"</span><span style="color: #1e90ff; font-weight: bold">/></span> |
| 163 | +<span style="color: #1e90ff; font-weight: bold"><dom-module</span> <span style="color: #1e90ff">id=</span><span style="color: #aa5500">"nested-grid-demo"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 164 | + |
| 165 | + <span style="color: #1e90ff; font-weight: bold"><link</span> <span style="color: #1e90ff">rel=</span><span style="color: #aa5500">"import"</span> <span style="color: #1e90ff">href=</span><span style="color: #aa5500">"../lavu-grid.html"</span> <span style="color: #1e90ff; font-weight: bold">/></span> |
| 166 | + |
| 167 | + <span style="color: #1e90ff; font-weight: bold"><style></span> |
| 168 | + :host { |
| 169 | + } |
| 170 | + :host .content-1, |
| 171 | + :host .content-2 { |
| 172 | + height: 100px; |
| 173 | + box-sizing: border-box; |
| 174 | + color: #fff; |
| 175 | + padding-left: 8px; |
| 176 | + padding-top: 4px; |
| 177 | + } |
| 178 | + :host .content-2 { |
| 179 | + height: 50px; |
| 180 | + } |
| 181 | + :host .cornflower-blue { |
| 182 | + background-color: cornflowerBlue; |
| 183 | + } |
| 184 | + :host .golden-rod { |
| 185 | + background-color: goldenRod; |
| 186 | + } |
| 187 | + :host .dark-orchid { |
| 188 | + background-color: darkOrchid; |
| 189 | + } |
| 190 | + :host .medium-orchid { |
| 191 | + background-color: mediumOrchid; |
| 192 | + } |
| 193 | + :host .coral { |
| 194 | + background-color: #F08080; |
| 195 | + } |
| 196 | + :host .olive { |
| 197 | + background-color: olive; |
| 198 | + } |
| 199 | + .outer { |
| 200 | + --lavu-grid: { |
| 201 | + margin: 8px 8px 16px; |
| 202 | + } |
| 203 | + } |
| 204 | + <span style="color: #1e90ff; font-weight: bold"></style></span> |
| 205 | + |
| 206 | + <span style="color: #1e90ff; font-weight: bold"><template></span> |
| 207 | + |
| 208 | + <span style="color: #1e90ff; font-weight: bold"><lavu-grid</span> <span style="color: #FF0000; background-color: #FFAAAA">no-spacing</span> <span style="color: #1e90ff">on-media-query-changed=</span><span style="color: #aa5500">'_mediaQueryChanged'</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"outer"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 209 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"6"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"cornflower-blue"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 210 | + <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-1"</span><span style="color: #1e90ff; font-weight: bold">></span>Nested grid<span style="color: #1e90ff; font-weight: bold"></div></span> |
| 211 | + <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
| 212 | + |
| 213 | + <span style="color: #1e90ff; font-weight: bold"><template</span> <span style="color: #1e90ff">is=</span><span style="color: #aa5500">"dom-if"</span> <span style="color: #1e90ff">if=</span><span style="color: #aa5500">"{{!_isScreenMd}}"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 214 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"7"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 215 | + <span style="color: #1e90ff; font-weight: bold"><lavu-grid</span> <span style="color: #FF0000; background-color: #FFAAAA">no-spacing</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 216 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-sm=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"golden-rod"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 217 | + <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
| 218 | + <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
| 219 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-sm=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"dark-orchid"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 220 | + <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
| 221 | + <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
| 222 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-sm=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"olive"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 223 | + <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
| 224 | + <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
| 225 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-sm=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"coral"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 226 | + <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
| 227 | + <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
| 228 | + <span style="color: #1e90ff; font-weight: bold"></lavu-grid></span> |
| 229 | + <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
| 230 | + <span style="color: #1e90ff; font-weight: bold"></template></span> |
| 231 | + |
| 232 | + <span style="color: #1e90ff; font-weight: bold"><template</span> <span style="color: #1e90ff">is=</span><span style="color: #aa5500">"dom-if"</span> <span style="color: #1e90ff">if=</span><span style="color: #aa5500">"{{_isScreenMd}}"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 233 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"6"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"golden-rod"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 234 | + <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-1"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
168 | 235 | <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
169 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-sm=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"dark-orchid"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 236 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"dark-orchid"</span><span style="color: #1e90ff; font-weight: bold">></span> |
170 | 237 | <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
171 | 238 | <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
172 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-sm=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"olive"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 239 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"olive"</span><span style="color: #1e90ff; font-weight: bold">></span> |
173 | 240 | <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
174 | 241 | <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
175 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span=</span><span style="color: #aa5500">"8"</span> <span style="color: #1e90ff">span-sm=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"coral"</span><span style="color: #1e90ff; font-weight: bold">></span> |
| 242 | + <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"coral"</span><span style="color: #1e90ff; font-weight: bold">></span> |
176 | 243 | <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
177 | 244 | <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
178 | | - <span style="color: #1e90ff; font-weight: bold"></lavu-grid></span> |
179 | | - <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
180 | | - <span style="color: #1e90ff; font-weight: bold"></template></span> |
| 245 | + <span style="color: #1e90ff; font-weight: bold"></template></span> |
| 246 | + <span style="color: #1e90ff; font-weight: bold"></lavu-grid></span> |
181 | 247 |
|
182 | | - <span style="color: #1e90ff; font-weight: bold"><template</span> <span style="color: #1e90ff">is=</span><span style="color: #aa5500">"dom-if"</span> <span style="color: #1e90ff">if=</span><span style="color: #aa5500">"{{_isScreenMd}}"</span><span style="color: #1e90ff; font-weight: bold">></span> |
183 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"6"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"golden-rod"</span><span style="color: #1e90ff; font-weight: bold">></span> |
184 | | - <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-1"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
185 | | - <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
186 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"dark-orchid"</span><span style="color: #1e90ff; font-weight: bold">></span> |
187 | | - <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
188 | | - <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
189 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"olive"</span><span style="color: #1e90ff; font-weight: bold">></span> |
190 | | - <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
191 | | - <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
192 | | - <span style="color: #1e90ff; font-weight: bold"><lavu-cell</span> <span style="color: #1e90ff">span-md=</span><span style="color: #aa5500">"4"</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"coral"</span><span style="color: #1e90ff; font-weight: bold">></span> |
193 | | - <span style="color: #1e90ff; font-weight: bold"><div</span> <span style="color: #1e90ff">class=</span><span style="color: #aa5500">"content-2"</span><span style="color: #1e90ff; font-weight: bold">></div></span> |
194 | | - <span style="color: #1e90ff; font-weight: bold"></lavu-cell></span> |
195 | 248 | <span style="color: #1e90ff; font-weight: bold"></template></span> |
196 | | -<span style="color: #1e90ff; font-weight: bold"></lavu-grid></span> |
| 249 | + |
| 250 | + <span style="color: #1e90ff; font-weight: bold"><script></span> |
| 251 | + (function() { |
| 252 | + Polymer({ |
| 253 | + is: 'nested-grid-demo', |
| 254 | + |
| 255 | + properties: { |
| 256 | + _screenClass: { |
| 257 | + type: String |
| 258 | + }, |
| 259 | + _isScreenMd: { |
| 260 | + type: Boolean |
| 261 | + } |
| 262 | + }, |
| 263 | + _mediaQueryChanged: function(e) { |
| 264 | + console.log('media-query-changed' + ': ' |
| 265 | + + e.detail.screenClass + ', ' + e.detail.mediaQuery); |
| 266 | + |
| 267 | + this._screenClass = e.detail.screenClass; |
| 268 | + this._isScreenMd = this._screenClass === 'screen-md'; |
| 269 | + } |
| 270 | + }); |
| 271 | + })(); |
| 272 | + <span style="color: #1e90ff; font-weight: bold"></script></span> |
| 273 | +<span style="color: #1e90ff; font-weight: bold"></dom-module></span> |
197 | 274 | </pre></div> |
198 | 275 |
|
| 276 | + |
199 | 277 | </div> |
200 | 278 |
|
201 | 279 |
|
|
0 commit comments