diff options
Diffstat (limited to 'web/src/js/components/ContentView/UploadContentButton.jsx')
-rw-r--r-- | web/src/js/components/ContentView/UploadContentButton.jsx | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/web/src/js/components/ContentView/UploadContentButton.jsx b/web/src/js/components/ContentView/UploadContentButton.jsx index 0652b584..de349af4 100644 --- a/web/src/js/components/ContentView/UploadContentButton.jsx +++ b/web/src/js/components/ContentView/UploadContentButton.jsx @@ -1,28 +1,18 @@ import { PropTypes } from 'react' +import FileChooser from '../common/FileChooser' UploadContentButton.propTypes = { uploadContent: PropTypes.func.isRequired, } export default function UploadContentButton({ uploadContent }) { - - let fileInput; - + return ( - <a className="btn btn-default btn-xs" - onClick={() => fileInput.click()} - title="Upload a file to replace the content."> - <i className="fa fa-upload"/> - <input - ref={ref => fileInput = ref} - className="hidden" - type="file" - onChange={e => { - if (e.target.files.length > 0) uploadContent(e.target.files[0]) - }} - /> - </a> - + <FileChooser + icon="fa-upload" + title="Upload a file to replace the content." + onOpenFile={uploadContent} + className="btn btn-default btn-xs"/> ) } |