More Related Content Similar to Try Web Components (20) Try Web Components10. <x-flipbox>
<div>I'm the front face.</div>
<div>And I'm the back face.</div>
</x-flipbox>
http://mozilla.github.io/brick/demos/x-tag-flipbox/index.html
23. $
$
$
$
$
npm install -g yo
npm install generator-polymer -g
mkdir YOUR_PROJECT && cd $_
yo polymer
yo polymer:element YOUR_ELEMENT
http://www.html5rocks.com/en/tutorials/webcomponents/yeoman/
24. <polymer-element name="YOUR_ELEMENT-element" attributes="">
<template>
<style>
@host { :scope {display: block;} }
</style>
<span>I'm <b>YOURELEMENT-element</b>. This is my Shadow
DOM.</span>
</template>
<script>
Polymer('YOUR_ELEMENT-element', {
//applyAuthorStyles: true,
//resetStyleInheritance: true,
created: function() { },
enteredView: function() { },
leftView: function() { },
attributeChanged: function(attrName, oldVal, newVal) { }
});
</script>
</polymer-element>
25. <polymer-element name="YOUR_ELEMENT-element" attributes="">
<template>
<style>
@host { :scope {display: block;} }
</style>
<span>I'm <b>YOURELEMENT-element</b>. This is my Shadow
DOM.</span>
</template>
<script>
Polymer('YOUR_ELEMENT-element', {
//applyAuthorStyles: true,
//resetStyleInheritance: true,
created: function() { },
enteredView: function() { },
leftView: function() { },
attributeChanged: function(attrName, oldVal, newVal) { }
});
</script>
</polymer-element>
26. <polymer-element name="YOUR_ELEMENT-element" attributes="">
<template>
<style>
@host { :scope {display: block;} }
</style>
<span>I'm <b>YOURELEMENT-element</b>. This is my Shadow
DOM.</span>
</template>
<script>
Polymer('YOUR_ELEMENT-element', {
//applyAuthorStyles: true,
//resetStyleInheritance: true,
created: function() { },
enteredView: function() { },
leftView: function() { },
attributeChanged: function(attrName, oldVal, newVal) { }
});
</script>
</polymer-element>
Please...
31. <x-appbar heading="Feed" class="the-header">
<a href="./home" class="appbar-left">
<x-icon type="fa-list" attr="fa-lg"></x-icon>
</a>
<a href="./gear" class="appbar-right">
<x-icon type="fa-gear" attr="fa-lg"></x-icon>
</a>
</x-appbar>
32. <x-tabs class="the-tabs">
<div>
<x-icon type="fa-pencil" attr="fa-lg"></x-icon> Status
</div>
<div>
<x-icon type="fa-camera" attr="fa-lg"></x-icon> Photo
</div>
<div>
<x-icon type="fa-map-marker" attr="fa-lg"></x-icon> Check-in
</div>
</x-tabs>
36. <polymer-element name="x-like" attributes="type count">
<template>
<x-icon type="{{type}}" attr="fa-lg" on-click="{{countup}}"></xicon> <span>{{count}}</span>
</template>
<script>
Polymer('x-like', {
type: "fa-thumbs-o-up",
count: "",
countup: function() {
this.count++;
this.type = "fa-thumbs-up";
}
});
</script>
</polymer-element>
elements/x-like.html