File size: 1,345 Bytes
0ad74ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<script context="module">
	import { Template, Story } from "@storybook/addon-svelte-csf";
	import { format } from "svelte-i18n";
	import FileUpload from "./shared/FileUpload.svelte";
	import { get } from "svelte/store";

	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>

<Template let:args>
	<FileUpload {...args} i18n={get(format)} />
</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"
	}}
/>