-
Notifications
You must be signed in to change notification settings - Fork 4k
/
index.js
51 lines (44 loc) · 1.02 KB
/
index.js
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
/**
* WordPress dependencies
*/
import { upload as uploadIcon } from '@wordpress/icons';
/**
* Internal dependencies
*/
import FormFileUpload from '../';
export default {
title: 'Components/FormFileUpload',
component: FormFileUpload,
};
export const Default = FormFileUpload.bind( {} );
Default.args = {
accept: '',
children: 'Select file',
multiple: false,
};
export const RestrictFileTypes = FormFileUpload.bind( {} );
RestrictFileTypes.args = {
...Default.args,
accept: 'image/*',
children: 'Select image',
multiple: false,
};
export const AllowMultipleFiles = FormFileUpload.bind( {} );
AllowMultipleFiles.args = {
...Default.args,
children: 'Select files',
multiple: true,
};
export const WithIcon = FormFileUpload.bind( {} );
WithIcon.args = {
...Default.args,
children: 'Upload',
icon: uploadIcon,
};
export const WithCustomRender = FormFileUpload.bind( {} );
WithCustomRender.args = {
...Default.args,
render: ( { openFileDialog } ) => (
<button onClick={ openFileDialog }>Custom Upload Button</button>
),
};