Created EditPage container

This commit is contained in:
cyril lopez 2018-03-07 15:13:54 +01:00
parent 1ee852c485
commit ea2a9237be

View File

@ -17,6 +17,11 @@ import styles from './styles.scss';
class PluginInputFile extends React.PureComponent { class PluginInputFile extends React.PureComponent {
state = { isDraging: false }; state = { isDraging: false };
handleChange = (e) => {
const dataTransfer = e.target;
this.props.onDrop({ dataTransfer });
}
handleDragEnter = () => this.setState({ isDraging: true }); handleDragEnter = () => this.setState({ isDraging: true });
handleDragLeave = () => this.setState({ isDraging: false }); handleDragLeave = () => this.setState({ isDraging: false });
@ -30,7 +35,6 @@ class PluginInputFile extends React.PureComponent {
render() { render() {
const { const {
name, name,
onChange,
showLoader, showLoader,
} = this.props; } = this.props;
const { isDraging } = this.state; const { isDraging } = this.state;
@ -62,7 +66,7 @@ class PluginInputFile extends React.PureComponent {
<input <input
multiple multiple
name={name} name={name}
onChange={onChange} onChange={this.handleChange}
type="file" type="file"
/> />
</label> </label>
@ -70,13 +74,10 @@ class PluginInputFile extends React.PureComponent {
} }
} }
PluginInputFile.defaultProps = { PluginInputFile.defaultProps = {};
onChange: () => {},
};
PluginInputFile.propTypes = { PluginInputFile.propTypes = {
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
onChange: PropTypes.func,
onDrop: PropTypes.func.isRequired, onDrop: PropTypes.func.isRequired,
showLoader: PropTypes.bool.isRequired, showLoader: PropTypes.bool.isRequired,
}; };