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
1 changed files with 11 additions and 4 deletions

View File

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