gradio

Форк
0
/
DownloadButton.stories.svelte 
89 строк · 2.2 Кб
1
<script>
2
	import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
3
	import DownloadButton from "./Index.svelte";
4
</script>
5

6
<Meta
7
	title="Components/DownloadButton"
8
	component={DownloadButton}
9
	argTypes={{
10
		label: {
11
			control: "text",
12
			description: "The text to display on the button",
13
			name: "label",
14
			value: "Gradio Button"
15
		},
16
		variant: {
17
			options: ["primary", "secondary", "stop"],
18
			description: "The variant of the button",
19
			control: { type: "select" },
20
			defaultValue: "primary"
21
		},
22
		size: {
23
			options: ["sm", "lg"],
24
			description: "The size of the button",
25
			control: { type: "select" },
26
			defaultValue: "lg"
27
		},
28
		visible: {
29
			options: [true, false],
30
			description: "Sets the visibility of the button",
31
			control: { type: "boolean" },
32
			defaultValue: true
33
		},
34
		interactive: {
35
			options: [true, false],
36
			description: "If false, the button will be in a disabled state",
37
			control: { type: "boolean" },
38
			defaultValue: true
39
		},
40
		disabled: {
41
			options: [true, false],
42
			control: { type: "boolean" },
43
			defaultValue: false
44
		},
45
		scale: {
46
			options: [null, 0.5, 1, 2],
47
			description:
48
				"relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. Only applies in Rows, or top-level Components in Blocks where fill_height=True. ",
49
			control: { type: "select" }
50
		}
51
	}}
52
/>
53

54
<Template let:args>
55
	<DownloadButton value="" interactive="true" {...args} />
56
</Template>
57

58
<Story
59
	name="Primary"
60
	args={{ label: "Download", variant: "primary", size: "lg", scale: 1 }}
61
/>
62
<Story
63
	name="Secondary"
64
	args={{ label: "Download", variant: "secondary", size: "lg" }}
65
/>
66
<Story name="Stop" args={{ label: "Download", variant: "stop", size: "lg" }} />
67
<Story
68
	name="Button with external image icon"
69
	args={{
70
		label: "Download",
71
		icon: {
72
			path: "https://huggingface.co/front/assets/huggingface_logo-noborder.svg",
73
			url: "https://huggingface.co/front/assets/huggingface_logo-noborder.svg"
74
		}
75
	}}
76
/>
77
<Story
78
	name="Button with visible equal to false"
79
	args={{
80
		label: "Download",
81
		visible: false
82
	}}
83
/>
84
<Story
85
	name="Button with null label (should be collapsed)"
86
	args={{
87
		label: null
88
	}}
89
/>
90

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.