diff --git a/public/edit.css b/public/edit.css index dee7afa..ebfcfe9 100644 --- a/public/edit.css +++ b/public/edit.css @@ -152,17 +152,20 @@ body { margin-bottom: 10px; } -.dropZone { +#dropZone { position: fixed; - top: 0px; - left: 0px; + top: 20px; + right: 20px; + bottom: 20px; + left: 20px; + display: none; + border: 8px rgba(100,100,100) dotted; + background-color: rgba(105, 255, 105, 0.9); + z-index: 1; + align-items: center; + justify-content: center; + color: rgba(100,100,100); +} +#dropZone.focused { display: flex; - margin: 10px; - width: 100px; - height: 100px; - border: 2px rgba(200,200,200, 0.5) dotted; -} -.dropZone.focused { - border: 2px rgba(105,255,105, 0.5) dotted; - background-color: rgba(105, 255, 105, 0.5); } diff --git a/public/dropZone.js b/src/dropZone.js similarity index 84% rename from public/dropZone.js rename to src/dropZone.js index 5c290d4..f61bd85 100644 --- a/public/dropZone.js +++ b/src/dropZone.js @@ -1,11 +1,16 @@ -const dropZone = document.querySelector('.dropZone') const setupDropZone = () => { + const dropZone = document.querySelector('#dropZone') + const title = document.querySelector('#dropZone__title') + if (!dropZone) { + return + } createDropEvent = (clear=true) => { return (e) => { if (clear) { dropZone.classList.remove('focused') } else { dropZone.classList.add('focused') + title.innerText = `Uploading ${e.dataTransfer.items.length} files` } e.preventDefault() e.stopPropagation() @@ -48,6 +53,6 @@ const setupDropZone = () => { }) } -if (dropZone) { - setupDropZone() +module.exports = { + setupDropZone } diff --git a/src/index.js b/src/index.js index 882f116..b45bb75 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,6 @@ /* globals clientPath */ const { setupChangeLogs } = require('./changeLogs') +const { setupDropZone } = require('./dropZone') const setupHome = require('./home') const setupNew = require('./new') @@ -11,9 +12,11 @@ const startApp = () => { return setupHome() } if (clientPath === 'new') { + setupDropZone() return setupNew() } if (clientPath === 'edit') { + setupDropZone() return setupEdit() } if (clientPath === 'view') { diff --git a/views/notes.ejs b/views/notes.ejs index b94aa49..bcd2e15 100644 --- a/views/notes.ejs +++ b/views/notes.ejs @@ -9,6 +9,9 @@ const clientPath = '<%- data.path %>'
<%- data.rawData -%>+