webamp/js/components/DragTarget.jsx
Jordan Eldredge 2b6b7f30b5 Rename and move files for better clarity (#186)
* Rename and move files for better clarity

* Add sample mp3 file
2016-08-02 10:10:17 -07:00

30 lines
537 B
JavaScript

import React from 'react';
class DragTarget extends React.Component {
constructor(props) {
super(props);
this.handleDrop = this.handleDrop.bind(this);
}
supress(e) {
e.stopPropagation();
e.preventDefault();
}
handleDrop(e) {
this.supress(e);
this.props.handleFiles(e.dataTransfer.files);
}
render() {
return <div
onDragEnter={this.supress}
onDragOver={this.supress}
onDrop={this.handleDrop}
>
{this.props.children}
</div>;
}
}
module.exports = DragTarget;