import Image from './image' import Text from './text' export default class FileInput extends PureComponent { static propTypes = { onChange: PropTypes.func, file: PropTypes.any, fileType: PropTypes.string, disabled: PropTypes.bool, title: PropTypes.string, height: PropTypes.string, width: PropTypes.string, } static defaultProps = { fileType: 'image' } state = { file: this.props.file, } handleOnChange = (e) => { this.props.onChange(e) this.setState({ file: URL.createObjectURL(e.target.files[0]) }) } render() { const { fileType, disabled, title, height, width, } = this.props const { file } = this.state return (
{ !!title &&
{title}
}
) } }