aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/ContentView/UploadContentButton.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/js/components/ContentView/UploadContentButton.jsx')
-rw-r--r--web/src/js/components/ContentView/UploadContentButton.jsx20
1 files changed, 6 insertions, 14 deletions
diff --git a/web/src/js/components/ContentView/UploadContentButton.jsx b/web/src/js/components/ContentView/UploadContentButton.jsx
index 0652b584..6764e234 100644
--- a/web/src/js/components/ContentView/UploadContentButton.jsx
+++ b/web/src/js/components/ContentView/UploadContentButton.jsx
@@ -1,4 +1,5 @@
import { PropTypes } from 'react'
+import FileChooser from '../common/FileChooser'
UploadContentButton.propTypes = {
uploadContent: PropTypes.func.isRequired,
@@ -9,20 +10,11 @@ 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"/>
)
}