const html = require('choo/html'); const assets = require('../../common/assets'); const fileList = require('./fileList'); const { fadeOut } = require('../utils'); module.exports = function(state, emit) { const div = html`
${state.translate('uploadPageHeader')}
${state.translate('uploadPageExplainer')}
${state.translate('uploadPageLearnMore')}
${state.translate('uploadPageDropMessage')}
${state.translate('uploadPageSizeMessage')}
${fileList(state, emit)}
`; function dragover(event) { const div = document.querySelector('.upload-window'); div.classList.add('ondrag'); } function dragleave(event) { const div = document.querySelector('.upload-window'); div.classList.remove('ondrag'); } function onfocus(event) { event.target.classList.add('has-focus'); } function onblur(event) { event.target.classList.remove('has-focus'); } async function upload(event) { event.preventDefault(); const target = event.target; const file = target.files[0]; if (file.size === 0) { return; } await fadeOut('page-one'); emit('upload', { file, type: 'click' }); } if (state.layout) { return state.layout(state, div); } return div; };