forked from mdwragg/polymer-font-awesome
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathpx-icon.html
93 lines (84 loc) · 2.92 KB
/
px-icon.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!--
Copyright (c) 2018, General Electric
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<link rel="import" href="../polymer/polymer.html"/>
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html"/>
<link rel="import" href="../iron-icon/iron-icon.html"/>
<dom-module id="px-icon">
<template>
<style>
:host {
/* Create some vars we can manipulate as our icons change*/
--px-icon-default-width: 22px;
--px-icon-default-height: 22px;
/* Update iron-icon vars so we can overwrite */
--iron-icon-width: var(--px-icon-default-width);
--iron-icon-height: var(--px-icon-default-height);
/* Ensures the currentColor is overriden by the stroke color so text
elements inside the SVG work correctly */
color: var(--iron-icon-stroke-color, inherit);
/* Reverses the standard iron-icon colors to have the stroke inherit
currentcolor and fill default to none */
fill: var(--iron-icon-fill-color, none);
stroke: var(--iron-icon-stroke-color, currentColor);
/* The rest of the properties are copied exactly from iron-icon */
@apply --layout-inline;
@apply --layout-center-center;
position: relative;
vertical-align: middle;
width: var(--iron-icon-width);
height: var(--iron-icon-height);
stroke-width: var(--px-icon-stroke-width, 1);
@apply --iron-icon;
}
/* Also copied exactly from iron-icon */
:host([hidden]) {
display: none;
}
/* Set default sizes for all icons sets */
:host([icon^='px-utl']),
:host([icon^='px-doc']) {
--px-icon-default-width: 16px;
--px-icon-default-height: 16px;
}
:host([icon^='px-obj']),
:host([icon^='px-fea']),
:host([icon^='px-com']) {
--px-icon-default-width: 32px;
--px-icon-default-height: 32px;
}
/* Forces iron-icon to inherit the :host scoped fill/stroke styles */
iron-icon {
color: inherit;
fill: inherit;
stroke: inherit;
}
</style>
<iron-icon icon="[[icon]]"></iron-icon>
</template>
</dom-module>
<script>
Polymer({
is:'px-icon',
properties: {
icon: {
type: String,
reflectToAttribute: true,
observer: '_updateStylesIndirect'
}
},
_updateStylesIndirect: function() {
//calling this without argument
this.updateStyles();
}
})
</script>