-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwid-card-level-con.js
More file actions
80 lines (68 loc) · 1.72 KB
/
wid-card-level-con.js
File metadata and controls
80 lines (68 loc) · 1.72 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
76
77
78
79
80
'use strict';
(function () {
Polymer({
is: 'wid-card-level-con',
behaviors: [Polymer.WidCardStandardBehavior, Polymer.WidCardWeightBehavior, Polymer.WidCardSubscriptionsBehavior, Polymer.WidCardThemeBehavior],
properties: {
/**
* level
* @type {Boolean}
*/
level: {
type: Number,
value: 0,
observer: '_onLevelChanged'
},
/**
* name
* @type {String}
*/
name: {
type: String,
value: 'Level Con'
},
/**
* title
* @type {String}
*/
title: {
type: String,
value: 'Low'
},
/**
* reason
* @type {String}
*/
reason: {
type: String,
value: 'No Reason'
}
},
_onLevelChanged: function _onLevelChanged(newVal) {
this.$.descHeaderContainer.setAttribute('class', 'flex-2 layout horizontal center-center style-scope wid-card-level-con header-level-' + newVal);
this.$.descStatusContainer.setAttribute('class', 'row-icon flex-3 layout vertical center-center style-scope wid-card-level-con status-level-' + newVal);
this.$.cloudIcon.src = 'bower_components/wid-card-level-con/' + this._getIconLevel() + '.svg';
},
_getIconLevel: function _getIconLevel() {
var levelIcon = '';
switch (this.level) {
case 0:
levelIcon = 'sunny';
break;
case 1:
levelIcon = 'cloudy';
break;
case 2:
levelIcon = 'rainy';
break;
case 3:
levelIcon = 'stormy';
break;
case 4:
levelIcon = 'thunderous';
break;
}
return levelIcon;
}
});
})();