-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbwt-progress.html
79 lines (72 loc) · 2.25 KB
/
bwt-progress.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
<!--
@element bwt-progress-bar
-->
<link rel="import" href="bwt-upload-behavior.html">
<dom-module id="bwt-progress-bar">
<template>
<style is="custom-style">
:host {
display: block;
}
.progress-details {
display: flex;
}
.file {
display: flex;
}
.file .progress-details {
order: 2;
width: 15%;
}
.file .progress-bar {
order: 1;
width: 85%;
margin-top: 8px;
}
paper-progress {
--paper-progress-active-color: var(--progress-bar-color, #03a9f4);
--paper-progress-height: var(--progress-bar-height, 4px);
--paper-progress-indeterminate-cycle-duration: 3s;
@apply(--bwt-progress-bar-file-progress);
}
paper-progress[error] {
--paper-progress-active-color: var(--progress-error-color, #f40303);
--paper-progress-height: var(--progress-bar-height, 4px);
--paper-progress-indeterminate-cycle-duration: 3s;
@apply(--bwt-progress-bar-file-error);
}
.error {
color: var(--progress-error-color, #f40303);
}
</style>
<div class="progress-bars">
<template is="dom-if" if="[[error]]">
<div class="error">[[error]]</div>
</template>
<div class="file">
<div class="progress-details">
<div class="commands">
<iron-icon icon="file-upload-icons:autorenew" title="Retry Upload" on-click="_retryUpload" hidden$="[[!file.error]]"></iron-icon>
<iron-icon icon="file-upload-icons:check-circle" title="Image uploaded successfuly" hidden$="[[!file.complete]]"></iron-icon>
</div>
</div>
<div class="progress-bar" id="progressbar" hidden$="[[_showHideProgress(file.progress)]]">
<paper-progress value$="[[file.progress]]" id="paperProgress" error$="[[file.error]]"></paper-progress>
</div>
</div>
</div>
</template>
<script>
Polymer({
is: 'bwt-progress-bar',
behaviors: [BwtUploadBehavior],
observers: ['_onError(file.error)'],
_showHideProgress(progress) {
return (progress < 100) ? false : true;
},
_onError(error) {
this.$.paperProgress.updateStyles();
}
});
</script>
</dom-module>