@kano/web-components
Version:
Shared web-components for the Kano ecosystem.
78 lines (74 loc) • 3.46 kB
HTML
<html>
<head>
<meta charset="utf-8">
<script src="../../../../@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
<script type="text/javascript">
window.Polymer = {
dom: 'shadow'
};
</script>
<script type="module" src="../../../../@polymer/iron-flex-layout/iron-flex-layout.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-user-badge.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">
html, body {
background-color: #fbfbfb;
width: 100vw;
height: 100vh;
}
demo-snippet {
--demo-snippet-demo: {
@apply --layout-horizontal;
@apply --layout-center;
@apply --layout-center-justified;
};
}
kano-user-badge {
margin: 12px;
display: inline-block;
}
</style>
</custom-style>`;
document.body.appendChild($_documentContainer.content);
</script>
</head>
<body>
<script type="module">
const $_documentContainer = document.createElement('template');
$_documentContainer.innerHTML = `<div class="vertical-section-container centered">
<h3>User badges</h3>
<demo-snippet>
<template>
<kano-user-badge id="badge" xp="200" default-avatar="https://www.fillmurray.com/200/200" stroke-width="4" radius="50"></kano-user-badge>
<kano-user-badge xp="700" default-avatar="https://www.fillmurray.com/200/200"></kano-user-badge>
<kano-user-badge xp="2100"></kano-user-badge>
<script type="text/javascript">
document.addEventListener('WebComponentsReady', () => {
var badge = document.getElementById('badge');
badge.set('user', {
avatar: {
urls: {
character: 'http://vignette2.wikia.nocookie.net/filthy-frank/images/8/8d/516c32f08e03d.png/revision/latest?cb=20151019010624'
}
}
});
});
</script>
</template>
</demo-snippet>
</div>`;
document.body.appendChild($_documentContainer.content);
</script>