Skip to content

Commit

Permalink
Update imports
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Apr 2, 2024
1 parent eefe60f commit 132829f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 72 deletions.
19 changes: 10 additions & 9 deletions src/lib/components/forms/DocumentUpload.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
import { filesize } from "filesize";
import { _ } from "svelte-i18n";
import { File16, File24, Upload16, XCircleFill24 } from "svelte-octicons";
import Dropzone from "../common/Dropzone.svelte";
import Flex from "../common/Flex.svelte";
import Field from "../common/Field.svelte";
import FieldLabel from "../common/FieldLabel.svelte";
import InputSelect from "../common/InputSelect.svelte";
import Switch from "../common/Switch.svelte";
import Premium from "../common/Premium.svelte";
import Button from "../common/Button.svelte";
import Dropzone from "./Dropzone.svelte";
import Empty from "../common/Empty.svelte";
import InputText from "../common/InputText.svelte";
import InputFile from "../common/InputFile.svelte";
import Field from "./Field.svelte";
import FieldLabel from "./FieldLabel.svelte";
import Flex from "$lib/components/common/Flex.svelte";
import InputFile from "./InputFile.svelte";
import InputSelect from "./InputSelect.svelte";
import InputText from "./InputText.svelte";
import Premium from "../common/Premium.svelte";
import Switch from "$lib/components/common/Switch.svelte";
import { removeUnsupportedTypes } from "@/lib/utils/validateFiles";
import AccessLevel from "../documents/AccessLevel.svelte";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
};
export const meta = {
title: "Components / Common / Dropzone",
title: "Components / Forms / Dropzone",
component: Dropzone,
tags: ["autodocs"],
parameters: { layout: "centered" },
Expand Down
65 changes: 3 additions & 62 deletions src/routes/app/upload/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import { getContext } from "svelte";
import { DOCUMENT_TYPES } from "@/config/config.js";
import DocumentUpload from "$lib/components/forms/DocumentUpload.svelte";
import { create, upload, process } from "$lib/api/documents";
const me: Writable<User> = getContext("me");
Expand All @@ -14,16 +15,9 @@
$: documents = Array.from(files || []).map((file) => {
return {
id: null,
title: file.name,
description: "",
access: "private",
asset_url: "",
canonical_url: "",
created_at: new Date(),
edit_access: true,
data: {},
user: $me,
} as Document;
});
</script>
Expand All @@ -32,57 +26,4 @@
<title>Upload | DocumentCloud</title>
</svelte:head>

<div class="upload">
<h1>Upload</h1>

<form method="post">
<fieldset>
<label>
Files
<input
bind:files
type="file"
name="files"
multiple
accept={DOCUMENT_TYPES.join(",")}
/>
</label>
</fieldset>

<fieldset class="documents">
{#each documents || [] as doc, i}
{@const file = files[i]}
<h3>{file.name}</h3>
<label>
<span>Title</span>
<input name="title" type="text" bind:value={documents[i].title} />
</label>

<label>
<span>Description</span>
<textarea name="description" bind:value={documents[i].description}
></textarea>
</label>
{/each}
</fieldset>

<fieldset>
<input
disabled={!files || files.length === 0}
type="submit"
value="Upload"
/>
</fieldset>
</form>
</div>

<style>
.upload {
padding: 1em;
}
label {
display: flex;
gap: 1.5em;
}
</style>
<DocumentUpload />

0 comments on commit 132829f

Please sign in to comment.