change file modal structure

This commit is contained in:
MathuraMG 2016-08-10 15:49:03 -04:00
parent 703f9ff820
commit 1a45e4cb91

View file

@ -12,24 +12,27 @@ import FileUploader from './FileUploader';
// At some point this will probably be generalized to a generic modal // At some point this will probably be generalized to a generic modal
// in which you can insert different content // in which you can insert different content
// but for now, let's just make this work // but for now, let's just make this work
function NewFileModal(props) { class NewFileModal extends React.Component {
componentDidMount() {
document.getElementById('name').focus();
}
render() {
const modalClass = classNames({ const modalClass = classNames({
modal: true, modal: true,
'modal--reduced': !props.canUploadMedia 'modal--reduced': !this.props.canUploadMedia
}); });
return ( return (
<section className={modalClass}> <section className={modalClass}>
<div className="modal-content"> <div className="modal-content">
<div className="modal__header"> <div className="modal__header">
<h2 className="modal__title">Add File</h2> <h2 className="modal__title">Add File</h2>
<button className="modal__exit-button" onClick={props.closeModal}> <button className="modal__exit-button" onClick={this.props.closeModal}>
<InlineSVG src={exitUrl} alt="Close New File Modal" /> <InlineSVG src={exitUrl} alt="Close New File Modal" />
</button> </button>
</div> </div>
<NewFileForm {...props} /> <NewFileForm {...this.props} />
{(() => { {(() => {
if (props.canUploadMedia) { if (this.props.canUploadMedia) {
return ( return (
<div> <div>
<p className="modal__divider">OR</p> <p className="modal__divider">OR</p>
@ -42,6 +45,7 @@ function NewFileModal(props) {
</div> </div>
</section> </section>
); );
}
} }
NewFileModal.propTypes = { NewFileModal.propTypes = {