UNPKG

@kano/web-components

Version:

Shared web-components for the Kano ecosystem.

81 lines (71 loc) 3.78 kB
<html> <head> <title>kano-project-card demo</title> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> <meta name="mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes"> <script src="../../../../@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script> <script type="module" src="../../../../@polymer/iron-demo-helpers/demo-snippet.js"></script> <script type="module" src="../../../../@polymer/iron-demo-helpers/demo-pages-shared-styles.js"></script> <script type="module" src="../kano-project-card.js"></script> <!-- FIXME(polymer-modulizer): These imperative modules that innerHTML your HTML are a hacky way to be sure that any mixins in included style modules are ready before any elements that reference them are instantiated, otherwise the CSS @apply mixin polyfill won't be able to expand the underlying CSS custom properties. See: https://github.com/Polymer/polymer-modulizer/issues/154 --> <script type="module"> const $_documentContainer = document.createElement('template'); $_documentContainer.innerHTML = `<custom-style> <style is="custom-style" include="demo-pages-shared-styles"> kano-project-card { font-family: var(--font-body); border: 1px solid #ddd; } </style> </custom-style>`; document.body.appendChild($_documentContainer.content); </script> </head> <body unresolved> <script type="module"> const $_documentContainer = document.createElement('template'); $_documentContainer.innerHTML = `<div class="vertical-section-container centered"> <h3>Project card</h3> <demo-snippet class="no-padding"> <template> <kano-project-card id="card" asset-path="https://world.kano.me" label="make it"></kano-project-card> <kano-project-card id="card2" asset-path="https://world.kano.me" label="make it"></kano-project-card> <script> document.addEventListener('WebComponentsReady', function () { var card = document.querySelector('#card'); var card2 = document.querySelector('#card2'); card.project = { title: 'Turn on the light', image: '/new/assets/projects/icons/light/pixel_1.png', link: 'https://apps.kano.me/story/pixel_1', slug: "pixel_1", creator: "kevinmurphy", completed: false }; card2.project = { title: 'Turn on the light', image: '/assets/projects/icons/light/pixel_1.png', link: 'https://apps.kano.me/story/pixel_1', slug: "pixel_1", creator: "kevinmurphy", completed: true }; var cards = [card, card2]; cards.forEach(function(card) { card.label = card.project.completed ? "make again" : "make it"; }); }); &lt;/script> </template> </demo-snippet> </div>`; document.body.appendChild($_documentContainer.content); </script>