react: revert UppyWrapper version of <ProgressBar />

This commit is contained in:
Renée Kooi 2017-09-18 08:48:12 +02:00
parent ce5d19bb35
commit aaae797a0f
No known key found for this signature in database
GPG key ID: 30516CF2A8E63718

View file

@ -1,23 +1,49 @@
const React = require('react')
const PropTypes = require('prop-types')
const UppyCore = require('../core/Core')
const UppyWrapper = require('./Wrapper')
const UppyCore = require('../core')
const DragDropPlugin = require('../plugins/ProgressBar')
const h = React.createElement
/**
* React component that renders an area in which files can be dropped to be
* uploaded.
* React component that renders a progress bar at the top of the page.
*/
const ProgressBar = (props) =>
h(UppyWrapper, props)
class ProgressBar extends React.Component {
componentDidMount () {
const uppy = this.props.uppy
const options = Object.assign(
{},
this.props,
{ target: this.container }
)
delete options.uppy
uppy.use(DragDropPlugin, options)
this.plugin = uppy.getPlugin('ProgressBar')
}
componentWillUnmount () {
const uppy = this.props.uppy
uppy.removePlugin(this.plugin)
}
render () {
return h('div', {
ref: (container) => {
this.container = container
}
})
}
}
ProgressBar.propTypes = {
uppy: PropTypes.instanceOf(UppyCore).isRequired
uppy: PropTypes.instanceOf(UppyCore).isRequired,
fixed: PropTypes.bool
}
ProgressBar.defaultProps = {
plugin: 'ProgressBar'
}
module.exports = ProgressBar