/** * * PluginInputFile * */ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import Label from './Label'; import P from './P'; /* eslint-disable react/no-string-refs */ /* eslint-disable react/jsx-tag-spacing */ class PluginInputFile extends React.PureComponent { state = { isDraging: false }; handleChange = e => { const dataTransfer = e.target; this.props.onDrop({ dataTransfer }); }; handleDragEnter = () => this.setState({ isDraging: true }); handleDragLeave = () => this.setState({ isDraging: false }); handleDrop = e => { e.preventDefault(); this.setState({ isDraging: false }); this.props.onDrop(e); }; render() { const { name, showLoader } = this.props; const { isDraging } = this.state; const link = ( {message => {message}} ); return ( { e.preventDefault(); e.stopPropagation(); }} onDrop={this.handleDrop} > {!showLoader && ( )} {showLoader && ( )} ); } } PluginInputFile.defaultProps = {}; PluginInputFile.propTypes = { name: PropTypes.string.isRequired, onDrop: PropTypes.func.isRequired, showLoader: PropTypes.bool.isRequired, }; export default PluginInputFile;
{!showLoader && ( )} {showLoader && ( )}