-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathelements.html
More file actions
75 lines (67 loc) · 1.61 KB
/
elements.html
File metadata and controls
75 lines (67 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<link rel="import" href="bower_components/polymer/polymer.html">
<link rel="import" href="bower_components/iron-icons/iron-icons.html">
<link rel="import" href="index.html">
<dom-module id="demo-element">
<template>
<style>
:host {
}
</style>
<style>
:host {
font-family: sans-serif;
--icon-toggle-color: pink;
--icon-toggle-outline-color: black;
--icon-toggle-pressed-color: blue;
}
</style>
<iron-icon icon = "add-circle-outline" pressed></iron-icon>
</template>
</dom-module>
<dom-module id="iron-i">
<template>
<style>
/* shadow DOM styles go here */
:host {
display: inline-block;
}
iron-icon{
fill: var(--icon-toggle-color, rgba(0,0,0,0));
stroke: var(--icon-toggle-outline-color, currentcolor);
}
:host([pressed]) iron-icon{
fill: var(--icon-toggle-pressed-color,currentcolor);
}
</style>
<!-- shadow DOM goes here -->
<iron-icon icon = "[[toggleIcon]]" on-click="toggle">
</iron-icon>
</template>
<script>
class IronIcon extends Polymer.Element {
static get is() {
return 'iron-i';
}
static get properties(){
return{
pressed: {
type: Boolean,
notify: true,
reflectToAttribute: true,
value: false
},
toggleIcon: {
type: String
},
}
}
constructor() {
super();
}
toggle(){
this.pressed = !this.pressed;
}
}
customElements.define(IronIcon.is, IronIcon);
</script>
</dom-module>