UNPKG

api-console-assets

Version:

This repo only exists to publish api console components to npm

136 lines (106 loc) 3.3 kB
<!-- @license Copyright (c) 2016 The Polymer Project Authors. All rights reserved. This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as part of the polymer project is also subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes"> <title>Responsive grid layout using app-grid-style with distributed children</title> <script src="../../../webcomponentsjs/webcomponents-lite.js"></script> <link rel="import" href="../../../polymer/polymer.html"> <link rel="import" href="../app-grid-style.html"> <style> body { margin: 0; background-color: #ddd; } h1 { font-family: 'Roboto', 'Noto', sans-serif; text-align: center; font-size: 18px; line-height: 30px; font-weight: 400; margin: 10px 20px; } </style> </head> <body> <dom-module id="x-app"> <template> <style include="app-grid-style"> :host ::content { display: block; --app-grid-columns: 3; --app-grid-gutter: 10px; --app-grid-expandible-item-columns: 2; --app-grid-item-height: 20vw; } :host ::content ul { padding: 0; list-style: none; } :host ::content .item { list-style: none; background-color: white; } @media (min-width: 800px) { :host ::content .item:nth-child(5n+1) { @apply(--app-grid-expandible-item); } } @media (max-width: 799px) { :host ::content { --app-grid-columns: 2; --app-grid-gutter: 5px; --app-grid-expandible-item-columns: 2; } :host ::content .item:nth-child(3n+1) { @apply(--app-grid-expandible-item); } } </style> <content></content> </template> <script> HTMLImports.whenReady(function() { Polymer({ is: 'x-app', attached: function() { this._updateGridStyles = this._updateGridStyles || function() { this.updateStyles(); }.bind(this); window.addEventListener('resize', this._updateGridStyles); }, detached: function() { window.removeEventListener('resize', this._updateGridStyles); } }); }); </script> </dom-module> <h1>3 columns on large screens and 2 columns on small ones.</h1> <x-app> <ul class="app-grid"> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> <li class="item"></li> </ul> </x-app> </body> </html>