summaryrefslogtreecommitdiff
path: root/app/client/common/fileUpload.component.js
blob: 5a1291cd57d855aa2191a1f1b9941c3dc68d6035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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