spee.ch/react/containers/PublishTool.jsx

35 lines
790 B
React
Raw Normal View History

import React from 'react';
2018-01-11 17:38:01 -08:00
import Dropzone from './Dropzone.jsx';
2018-01-08 17:06:31 -08:00
import PublishForm from './PublishForm.jsx';
import PublishStatus from '../components/PublishStatus.jsx';
2018-01-08 17:06:31 -08:00
import {connect} from 'react-redux';
2018-01-05 18:26:57 -08:00
class PublishTool extends React.Component {
render () {
2018-01-11 15:37:32 -08:00
if (this.props.file) {
if (this.props.status) {
return (
<PublishStatus
status={this.props.status}
message={this.props.message}
/>
);
} else {
return <PublishForm />;
}
} else {
2018-01-11 17:38:01 -08:00
return <Dropzone />;
2018-01-11 15:37:32 -08:00
}
}
};
2018-01-08 17:06:31 -08:00
const mapStateToProps = state => {
return {
2018-01-11 15:37:32 -08:00
file : state.file,
status : state.status.status,
message: state.status.message,
2018-01-08 17:06:31 -08:00
};
};
export default connect(mapStateToProps, null)(PublishTool);