-
Notifications
You must be signed in to change notification settings - Fork 2
/
quality-label.html
78 lines (73 loc) · 1.85 KB
/
quality-label.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
<!--
`quality-label`
Label used to display annotation and evidence qualifier
#### Example of silver badge
<quality-label quality="silver"></quality-label>
#### Example of gold badge
<quality-label quality="silver"></quality-label>
@demo demo/quality-label-demo.html
-->
<dom-module id="quality-label">
<template>
<style is="quality-label-style">
:root {
font-size: 90%;
}
.quality-label-container {
display: inline-block;
}
.colored-label {
padding:1px 3px;
margin-bottom: 1px;
}
.quality-pointer {
color:#fff;
border-radius: 2px 0px 0px 2px;
margin-left: 5px;
}
.pointer-gold {
background: #ba8604;
}
.pointer-silver {
background:#B6BCC5;
}
.prefixed-label {
text-transform: capitalize;
border-radius: 0px 2px 2px 0px;
}
.label-gold {
background:#DAA520;
color: #fff;
}
.label-silver {
background:#DEDEDE;
color:#999;
}
</style>
<template id="menu" is="dom-if" if="{{quality}}">
<div class="quality-label-container">
<span class$="colored-label quality-pointer pointer-{{quality}}">•</span><span class$="colored-label prefixed-label label-{{quality}}">{{quality}}</span>
</div>
</template>
</template>
<script>
Polymer({
is: 'quality-label',
properties: {
quality: {
type: String,
observer: '_checkQualityValue'
}
},
_checkQualityValue: function(){
if (this.quality) {
this.quality = this.quality.toLowerCase();
if (this.quality!=='gold' && this.quality!=='silver') this.quality = null;
}
else {
this.quality = null;
}
}
});
</script>
</dom-module>