-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3217b4
commit 9c3c6f7
Showing
2 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<script> | ||
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"; | ||
import FileUpload from "./shared/FileUpload.svelte"; | ||
// export const meta = { | ||
// title: "Components/FileUpload", | ||
// component: FileUpload, | ||
// argTypes: { | ||
// value: { | ||
// control: "text", | ||
// description: "The URL or filepath (or list of URLs or filepaths)", | ||
// name: "value", | ||
// value: [] | ||
// }, | ||
// file_count: { | ||
// control: "radio", | ||
// options: ["single", "multiple"], | ||
// description: "Whether to allow single or multiple files to be uploaded", | ||
// name: "file_count", | ||
// value: "single" | ||
// }, | ||
// } | ||
// } | ||
</script> | ||
|
||
<Meta | ||
title="Components/FileUpload" | ||
component={FileUpload} | ||
argTypes={{ | ||
value: { | ||
control: "text", | ||
description: "The URL or filepath (or list of URLs or filepaths)", | ||
name: "value", | ||
value: [] | ||
}, | ||
file_count: { | ||
control: "radio", | ||
options: ["single", "multiple"], | ||
description: "Whether to allow single or multiple files to be uploaded", | ||
name: "file_count", | ||
value: "single" | ||
} | ||
}} | ||
/> | ||
|
||
<Template let:args> | ||
<FileUpload {...args} i18n={{ "file.uploading": "Uploading" }} /> | ||
</Template> | ||
|
||
<Story | ||
name="Single File" | ||
args={{ | ||
value: [ | ||
{ | ||
path: "cheetah.jpg", | ||
orig_name: "cheetah.jpg", | ||
url: "https://gradio-builds.s3.amazonaws.com/demo-files/ghepardo-primo-piano.jpg", | ||
size: 10000 | ||
} | ||
], | ||
file_count: "single" | ||
}} | ||
/> | ||
<Story | ||
name="Multiple files" | ||
args={{ | ||
value: Array(2).fill({ | ||
path: "cheetah.jpg", | ||
orig_name: "cheetah.jpg", | ||
url: "https://gradio-builds.s3.amazonaws.com/demo-files/ghepardo-primo-piano.jpg", | ||
size: 10000 | ||
}), | ||
file_count: "multiple" | ||
}} | ||
/> | ||
<Story | ||
name="No value" | ||
args={{ | ||
value: null, | ||
file_count: "multiple" | ||
}} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters