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,36 +12,40 @@ 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 {
const modalClass = classNames({ componentDidMount() {
modal: true, document.getElementById('name').focus();
'modal--reduced': !props.canUploadMedia }
}); render() {
const modalClass = classNames({
return ( modal: true,
<section className={modalClass}> 'modal--reduced': !this.props.canUploadMedia
<div className="modal-content"> });
<div className="modal__header"> return (
<h2 className="modal__title">Add File</h2> <section className={modalClass}>
<button className="modal__exit-button" onClick={props.closeModal}> <div className="modal-content">
<InlineSVG src={exitUrl} alt="Close New File Modal" /> <div className="modal__header">
</button> <h2 className="modal__title">Add File</h2>
<button className="modal__exit-button" onClick={this.props.closeModal}>
<InlineSVG src={exitUrl} alt="Close New File Modal" />
</button>
</div>
<NewFileForm {...this.props} />
{(() => {
if (this.props.canUploadMedia) {
return (
<div>
<p className="modal__divider">OR</p>
<FileUploader />
</div>
);
}
return '';
})()}
</div> </div>
<NewFileForm {...props} /> </section>
{(() => { );
if (props.canUploadMedia) { }
return (
<div>
<p className="modal__divider">OR</p>
<FileUploader />
</div>
);
}
return '';
})()}
</div>
</section>
);
} }
NewFileModal.propTypes = { NewFileModal.propTypes = {