-
Notifications
You must be signed in to change notification settings - Fork 0
/
lancie-error.html
112 lines (95 loc) · 2.48 KB
/
lancie-error.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<dom-module id="lancie-error">
<template>
<style>
.container {
width: inherit;
padding: 10px 20px;
}
.green {
border-left: 4px solid #4CAF50;
background: #C8E6C9;
color: #1B5E20;
}
.blue {
border-left: 4px solid #2196F3;
background: #BBDEFB;
color: #0D47A1;
}
.yellow {
border-left: 4px solid #FFEB3B;
background: #FFF9C4;
color: #F57F17;
}
.red {
border-left: 4px solid #F44336;
background: #FFCDD2;
color: #B71C1C;
}
[hidden] {
display: none !important;
}
</style>
<div class$="container {{_getClass(type)}}">
<span>[[message]]</span>
</div>
</template>
<script>
(function() {
'use strict';
Polymer({
is: 'lancie-error',
properties: {
hidden: {
type: Boolean,
value: true,
reflectToAttribute: true,
},
message: String,
type: String,
},
setSuccess: function(message) {
this.type = 'success';
this.setMessage(message);
},
setInfo: function(message) {
this.type = 'info';
this.setMessage(message);
},
setWarning: function(message) {
this.type = 'warning';
this.setMessage(message);
},
setError: function(message) {
this.type = 'error';
this.setMessage(message);
},
setMessage(message) {
this.message = message;
this.hidden = false;
},
clear: function() {
this.message = '';
this.hidden = true;
},
_getClass: function(type) {
switch (type) {
case 'success': return 'green';
case 'info': return 'blue';
case 'warning': return 'yellow';
case 'error': return 'red';
}
}
});
})();
</script>
</dom-module>