components.controls.FileUploader.ButtonUploader.tsx Maven / Gradle / Ivy
import React from 'react'
import classNames from 'classnames'
import { withTranslation } from 'react-i18next'
import { compose } from 'recompose'
import withFileUploader from './withFileUploader'
import FileUploader from './FileUploader'
interface ButtonUploaderChildrenProps {
children?: React.ReactNode;
icon: string;
label: string;
disabled: boolean;
}
function ButtonUploaderChildren({
children,
icon,
label,
disabled,
}: ButtonUploaderChildrenProps) {
return (
{children || (
<>
{label}
>
)}
)
}
interface ButtonUploaderProps {
t(key: string): string;
children?: React.ReactNode;
icon: string;
disabled?: boolean;
label?: string;
requestParam?: string;
visible?: boolean;
statusBarColor?: string;
multi?: boolean;
autoUpload?: boolean;
showSize?: boolean;
value?: unknown[];
onChange?(value: unknown[]): void;
}
function ButtonUploader({
t,
children,
icon,
disabled = false,
label = t('uploadFile'),
...props
}: ButtonUploaderProps) {
return (
// @ts-ignore ignore import error from js file
{children}
)
}
ButtonUploader.defaultProps = {
requestParam: 'file',
visible: true,
icon: 'fa fa-upload',
statusBarColor: 'success',
multi: true,
disabled: false,
autoUpload: true,
showSize: true,
value: [],
onChange: () => {},
}
export default compose(
withFileUploader,
withTranslation(),
// @ts-ignore ignore import error from js file
)(ButtonUploader)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy