File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ import React , { ComponentProps } from 'react' ;
2+
3+ import { useHandleFileChangeWrapper } from '../utils' ;
4+
5+ export type UploadButtonProps = {
6+ resetOnChange ?: boolean ;
7+ onFileChange : ( files : Array < File > ) => void ;
8+ } & Omit < ComponentProps < 'input' > , 'type' | 'onChange' > ;
9+
10+ export const UploadButton = ( {
11+ resetOnChange = true ,
12+ onFileChange,
13+ ...rest
14+ } : UploadButtonProps ) => {
15+ const handleInputChange = useHandleFileChangeWrapper (
16+ resetOnChange ,
17+ onFileChange ,
18+ ) ;
19+
20+ return < input type = "file" onChange = { handleInputChange } { ...rest } /> ;
21+ } ;
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ export * from './components/LoadingIndicator';
1010export * from './components/PictureIcon' ;
1111export * from './components/Thumbnail' ;
1212export * from './components/ThumbnailPlaceholder' ;
13+ export * from './components/UploadButton' ;
1314
1415export * from './types' ;
1516export { dataTransferItemsToFiles , dataTransferItemsHaveFiles } from './utils' ;
You can’t perform that action at this time.
0 commit comments