-
Notifications
You must be signed in to change notification settings - Fork 0
/
icon-toggle.html
62 lines (56 loc) · 1.22 KB
/
icon-toggle.html
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
<!-- Imports polymer -->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-icon/iron-icon.html">
<!--
Icon toggle
Example:
<icon-toggle toggle-icon="star"></icon-toggle>
@demo demo/index2.html
-->
<dom-module id="icon-toggle">
<template>
<style>
:host {
font-family: sans-serif;
cursor:pointer;
}
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>
<iron-icon icon="[[toggleIcon]]">
</iron-icon>
</template>
<!-- Registers custom element -->
<script>
Polymer({
is: 'icon-toggle',
properties: {
/*
* Toggle Icon property
*/
toggleIcon: String,
/*
* Observable variable over icons that can be toggled
*/
pressed: {
type: Boolean,
value: false,
notify: true,
reflectToAttribute: true
}
},
listeners: {
'tap': 'toggle'
},
toggle: function() {
this.fire('set_rate');
//{star: this.getAttribute('star')});
}
});
</script>
</dom-module>