diff --git a/package-lock.json b/package-lock.json index d9b94eafb..481f4b194 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "dompurify": "^3.0.8", "fast-copy": "^2.1.0", "fast-deep-equal": "^3.1.3", + "filesize": "^10.1.1", "isomorphic-dompurify": "^2.4.0", "jsdom": "^24.0.0", "lucene": "^2.1.1", @@ -11243,6 +11244,14 @@ "node": ">=10" } }, + "node_modules/filesize": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/filesize/-/filesize-10.1.1.tgz", + "integrity": "sha512-L0cdwZrKlwZQkMSFnCflJ6J2Y+5egO/p3vgRSDQGxQt++QbUZe5gMbRO6kg6gzwQDPvq2Fk9AmoxUNfZ5gdqaQ==", + "engines": { + "node": ">= 10.4.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", diff --git a/package.json b/package.json index 2c5b00d44..e8bbce250 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "dompurify": "^3.0.8", "fast-copy": "^2.1.0", "fast-deep-equal": "^3.1.3", + "filesize": "^10.1.1", "isomorphic-dompurify": "^2.4.0", "jsdom": "^24.0.0", "lucene": "^2.1.1", diff --git a/src/lib/components/forms/DocumentUpload.svelte b/src/lib/components/forms/DocumentUpload.svelte index 93cf41b10..86b3c823a 100644 --- a/src/lib/components/forms/DocumentUpload.svelte +++ b/src/lib/components/forms/DocumentUpload.svelte @@ -1,6 +1,7 @@ @@ -43,68 +82,84 @@
- {#if files.length > 0} - {#each files as file} - - {/each} + {#each files as file} + +

+ {formatFileType(file.type)} / {filesize(file.size)} +

+
+ { + console.log(file); + }} + /> +
+ +
{:else} Get started by selecting, pasting, or dragging-and-dropping files below - {/if} + {/each}
- +

Drag and drop files here

or - Select Files + Select Files
@@ -149,7 +204,7 @@ flex-direction: column; justify-content: center; align-items: center; - gap: 1rem; + gap: 0.5rem; align-self: stretch; border-radius: 0.5rem; @@ -157,6 +212,36 @@ background: var(--gray-1, #f5f6f7); } + .fileInfo { + flex: 1 0 0; + font-size: var(--font-xs); + color: var(--gray-5); + white-space: nowrap; + text-transform: uppercase; + } + + .fileName { + flex: 1 1 auto; + } + + .fileRemove { + display: inline-flex; + align-items: center; + justify-content: center; + height: 100%; + appearance: none; + background: transparent; + border: none; + border-radius: 0.5rem; + fill: var(--gray-3); + cursor: pointer; + } + + .fileRemove:hover, + .fileRemove:focus { + background: var(--blue-1); + } + .drop-instructions { color: var(--gray-5, #233944); text-align: center; @@ -183,9 +268,13 @@ } .sidebar { - height: 100%; max-width: 18rem; flex: 0 1 8rem; + + display: flex; + flex-direction: column; + justify-content: space-between; + gap: 2rem; } .divider { @@ -197,8 +286,4 @@ .ocrEngineHelp { font-size: var(--font-xs); } - - .ocrEngineHelp a { - color: var(--blue-3); - } diff --git a/src/lib/components/forms/stories/DocumentUpload.stories.svelte b/src/lib/components/forms/stories/DocumentUpload.stories.svelte index 0891ade0f..fd63c26eb 100644 --- a/src/lib/components/forms/stories/DocumentUpload.stories.svelte +++ b/src/lib/components/forms/stories/DocumentUpload.stories.svelte @@ -8,11 +8,27 @@ tags: ["autodocs"], parameters: { layout: "centered" }, }; + + const args = { + files: [], + }; - - + +