Skip to content

Commit 3048dcf

Browse files
committed
completed overlay
1 parent 6c2a911 commit 3048dcf

File tree

1 file changed

+86
-1
lines changed

1 file changed

+86
-1
lines changed

file-uploader-completed-overlay.html

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<link rel="import" href="../polymer/polymer.html">
22
<link rel="import" href="../overlay-container/animated-overlay-behavior.html">
33
<link rel="import" href="../app-localize-behavior/app-localize-behavior.html">
4+
<link rel="import" href="../iron-image/iron-image.html">
45
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
56

67
<!--
@@ -33,9 +34,54 @@
3334
}
3435
}
3536

37+
.header {
38+
@apply(--layout-horizontal);
39+
@apply(--layout-center);
40+
}
41+
42+
.header__title {
43+
@apply(--layout-flex);
44+
font-size: 18px;
45+
}
46+
47+
.header__close {
48+
color: var(--paper-grey-500);
49+
cursor: pointer;
50+
padding: 8px;
51+
}
52+
53+
.files {
54+
@apply(--layout-horizontal);
55+
@apply(--layout-wrap);
56+
}
57+
58+
.file {
59+
height: 80px;
60+
width: 50%;
61+
}
62+
63+
.file__iron-image {
64+
height: 100%;
65+
width: 100%;
66+
}
3667
</style>
3768

3869
<div id="container">
70+
<div class="header">
71+
<div class="header__title">[[_computeHeaderTitle(files, localize)]]</div>
72+
<iron-icon class="header__close" icon="close"></iron-icon>
73+
</div>
74+
75+
<div class="files">
76+
<template is="dom-repeat" items="[[uploadedFiles]]">
77+
<div class="file">
78+
<iron-image
79+
class="file__iron-image"
80+
src="[[_computeThumbnail(file)]]"
81+
sizing="cover"></iron-image>
82+
</div>
83+
</template>
84+
</div>
3985
</div>
4086

4187
</template>
@@ -50,12 +96,51 @@
5096
is: 'file-uploader-completed-overlay',
5197

5298
properties: {
99+
100+
files: {
101+
type: Array,
102+
observer: '_filesChanged'
103+
},
104+
105+
_filteredFiles: Array,
106+
107+
resources: {
108+
value: _ => {
109+
return {
110+
'en': {
111+
'HeaderTitle': '{length} items uploaded'
112+
},
113+
'es': {
114+
'HeaderTitle': 'Se han subido {length} elementos'
115+
}
116+
};
117+
}
118+
}
119+
53120
},
54121

55122
behaviors: [
56123
AnimatedOverlayBehavior,
57124
Polymer.AppLocalizeBehavior
58-
]
125+
],
126+
127+
_filesChanged(files) {
128+
if (Array.isArray(files)) {
129+
this._filteredFiles = files.splice(0, 5);
130+
}
131+
},
132+
133+
_computeHeaderTitle(files) {
134+
return this.localize('HeaderTitle', 'length', files.length);
135+
},
136+
137+
_computeThumbnail(file) {
138+
const isImage = /image\/.*/.exec(currentFile.type);
139+
140+
if (isImage) {
141+
return URL.createObjectURL(currentFile);
142+
}
143+
}
59144

60145
});
61146

0 commit comments

Comments
 (0)