fixes #994. add new files to top of upload area

This commit is contained in:
Danny Coates 2018-11-05 16:43:45 -08:00
parent 63796c8ccb
commit ae89f1964f
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB

View file

@ -174,11 +174,13 @@ module.exports = function(state, emit, archive) {
module.exports.wip = function(state, emit) {
return html`
<article class="h-full flex flex-col bg-white z-20">
<article class="h-full flex flex-col bg-white z-20" id="wip">
${list(
state.archive.files.map(f => fileInfo(f, remove(f))),
'list-reset h-full overflow-y-scroll p-4 bg-blue-lightest md:max-h-half-screen',
'bg-white px-2 mb-3 border border-grey-light rounded'
Array.from(state.archive.files)
.reverse()
.map(f => fileInfo(f, remove(f))),
'list-reset h-full overflow-y-scroll px-4 bg-blue-lightest md:max-h-half-screen',
'bg-white px-2 mt-3 border border-grey-light rounded'
)}
<div class="flex-grow p-4 bg-blue-lightest mb-6 font-medium">
<input
@ -224,6 +226,11 @@ module.exports.wip = function(state, emit) {
const newFiles = Array.from(event.target.files);
emit('addFiles', { files: newFiles });
setTimeout(() => {
document
.querySelector('#wip > ul > li:first-child')
.scrollIntoView({ block: 'center' });
});
}
function remove(file) {