summaryrefslogtreecommitdiff
path: root/app/client/common/fileUpload.component.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/client/common/fileUpload.component.js')
-rw-r--r--app/client/common/fileUpload.component.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/client/common/fileUpload.component.js b/app/client/common/fileUpload.component.js
new file mode 100644
index 0000000..5a1291c
--- /dev/null
+++ b/app/client/common/fileUpload.component.js
@@ -0,0 +1,28 @@
+import { h, Component } from 'preact'
+
+class FileUpload extends Component {
+ constructor(props){
+ super(props)
+ this.handleChange = this.handleChange.bind(this)
+ }
+ handleChange(e){
+ this.props.onChange && this.props.onChange()
+ }
+ render() {
+ return (
+ <div className='fileUpload param'>
+ <label>
+ <span>{this.props.title}</span>
+ <input
+ type='file'
+ multiple={this.props.multiple}
+ onChange={this.handleChange}
+ />
+ <button>{this.props.label || 'Choose file...'}</button>
+ </label>
+ </div>
+ )
+ }
+}
+
+export default FileUpload