import classNames from 'classnames/bind' import Image from './image' import Text from './text' const cx = classNames.bind(_s) 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: null, } 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}
}
) } }