diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-25 17:51:38 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-07-25 17:51:38 -0700 |
commit | 817b675c5296d25a1fc41d9c3e68effbcee31100 (patch) | |
tree | 5940b85167156d5a116046b04ef173591bd0ae6d /web/src/js/components/ContentView/UploadContentButton.jsx | |
parent | ffe6593361670a5963d2e07ed6ac2d5f022a66e7 (diff) | |
parent | 3ebb58f641612a4c512c045187ffe40879720fa7 (diff) | |
download | mitmproxy-817b675c5296d25a1fc41d9c3e68effbcee31100.tar.gz mitmproxy-817b675c5296d25a1fc41d9c3e68effbcee31100.tar.bz2 mitmproxy-817b675c5296d25a1fc41d9c3e68effbcee31100.zip |
Merge branch 'flow_editing_v2'
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> + + ) +} + |