diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-25 17:03:50 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-07-25 17:03:50 -0700 |
commit | 70dbd1b32d13d30e15c03ee91b0fab7bfdf429b3 (patch) | |
tree | 8c15d471934ac4b2c898725a2929f30f8dc7f9dd /web/src/js/components/ContentView/UploadContentButton.jsx | |
parent | 79ebcb046e8669f80357a6c3046ec76c6adf49be (diff) | |
download | mitmproxy-70dbd1b32d13d30e15c03ee91b0fab7bfdf429b3.tar.gz mitmproxy-70dbd1b32d13d30e15c03ee91b0fab7bfdf429b3.tar.bz2 mitmproxy-70dbd1b32d13d30e15c03ee91b0fab7bfdf429b3.zip |
web: refactor ContentLoader
Diffstat (limited to 'web/src/js/components/ContentView/UploadContentButton.jsx')
-rw-r--r-- | web/src/js/components/ContentView/UploadContentButton.jsx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/web/src/js/components/ContentView/UploadContentButton.jsx b/web/src/js/components/ContentView/UploadContentButton.jsx new file mode 100644 index 00000000..0652b584 --- /dev/null +++ b/web/src/js/components/ContentView/UploadContentButton.jsx @@ -0,0 +1,28 @@ +import { PropTypes } from 'react' + +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> + + ) +} + |