-
Notifications
You must be signed in to change notification settings - Fork 283
/
Copy pathImageUploadButton.tsx
41 lines (38 loc) · 1.05 KB
/
ImageUploadButton.tsx
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
import React, { PropsWithChildren } from 'react';
import { PictureIcon } from './icons';
import { UploadButton } from './UploadButton';
import { useTranslationContext } from '../../context';
export type ImageUploadButtonProps = {
handleFiles: (files: File[]) => void;
disabled?: boolean;
multiple?: boolean;
resetOnChange?: boolean;
};
/**
* @deprecated will be removed in the next major release
*/
export const ImageUploadButton = ({
multiple = false,
disabled = false,
handleFiles,
children = <PictureIcon />,
resetOnChange = false,
}: PropsWithChildren<ImageUploadButtonProps>) => {
const { t } = useTranslationContext('ImageUploadButton');
return (
<div className='rfu-image-upload-button'>
<label>
<UploadButton
accept='image/*'
aria-label={t('aria/Image input')}
className='rfu-image-input'
disabled={disabled}
multiple={multiple}
onFileChange={handleFiles}
resetOnChange={resetOnChange}
/>
{children}
</label>
</div>
);
};