summaryrefslogtreecommitdiff
path: root/app/client/common/fileUpload.component.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-05-28 13:06:54 +0200
committerJules Laplace <julescarbon@gmail.com>2018-05-28 13:06:54 +0200
commit2664eb3e474f5d03d1782c15673b774d68fb2c58 (patch)
tree1f1e58a6090f6befa75d8f6915388ddee30df04d /app/client/common/fileUpload.component.js
parent3a8d99c5e4f64a9426585943c40635eb183b47ae (diff)
textInput/fileUpload
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