Guest User

Untitled

a guest
May 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <body>
  4. <likeable-element></likeable-element>
  5. <paper-item>
  6. <paper-item-body two-line>
  7. <div>Show your status</div>
  8. <div secondary>Your status is visible to everyone</div>
  9. </paper-item-body>
  10. <iron-icon icon="warning"></iron-icon>
  11. </paper-item>
  12.  
  13. <script type="module">
  14. // Import an element
  15. import '//unpkg.com/@polymer/paper-checkbox/paper-checkbox.js?module';
  16.  
  17. // Import the PolymerElement base class and html helper
  18. import {PolymerElement, html} from '//unpkg.com/@polymer/polymer/polymer-element.js?module';
  19. import '//unpkg.com/@polymer/paper-item/paper-item.js?module';
  20.  
  21.  
  22. // Define an element class
  23. class LikeableElement extends PolymerElement {
  24.  
  25. // Define publc API properties
  26. static get properties() { return { liked: Boolean }}
  27.  
  28. // Define the element's template
  29. static get template() {
  30. return html`
  31. <style>
  32. .response { margin-top: 10px; }
  33. </style>
  34. <paper-checkbox checked="{{liked}}">I like web components.</paper-checkbox>
  35.  
  36. <div hidden$="[[!liked]]" class="response">Web components like you, too.</div>
  37. `;
  38. }
  39. }
  40.  
  41. // Register the element with the browser
  42. customElements.define('likeable-element', LikeableElement);
  43. </script>
  44. </body>
  45. </html>
Add Comment
Please, Sign In to add comment