const { localIcon } = require('./icons') const { h, Component } = require('preact') class AddFiles extends Component { constructor (props) { super(props) this.triggerFileInputClick = this.triggerFileInputClick.bind(this) this.handleFileInputChange = this.handleFileInputChange.bind(this) this.renderPoweredByUppy = this.renderPoweredByUppy.bind(this) this.renderHiddenFileInput = this.renderHiddenFileInput.bind(this) this.renderDropPasteBrowseTagline = this.renderDropPasteBrowseTagline.bind(this) this.renderMyDeviceAcquirer = this.renderMyDeviceAcquirer.bind(this) this.renderAcquirer = this.renderAcquirer.bind(this) } triggerFileInputClick () { this.fileInput.click() } handleFileInputChange (event) { this.props.handleInputChange(event) // We clear the input after a file is selected, because otherwise // change event is not fired in Chrome and Safari when a file // with the same name is selected. // ___Why not use value="" on instead? // Because if we use that method of clearing the input, // Chrome will not trigger change if we drop the same file twice (Issue #768). event.target.value = null } renderPoweredByUppy () { return ( {this.props.i18n('poweredBy') + ' '} Uppy ) } renderHiddenFileInput () { return ( { this.fileInput = ref }} /> ) } renderDropPasteBrowseTagline () { const browse = return (
{this.props.acquirers.length === 0 ? this.props.i18nArray('dropPaste', { browse }) : this.props.i18nArray('dropPasteImport', { browse })}
) } renderMyDeviceAcquirer () { return ( ) } renderAcquirer (acquirer) { return ( ) } render () { return (
{this.renderHiddenFileInput()}
{this.renderDropPasteBrowseTagline()} { this.props.acquirers.length > 0 &&
{this.renderMyDeviceAcquirer()} {this.props.acquirers.map((acquirer) => this.renderAcquirer(acquirer) )}
}
{this.props.note &&
{this.props.note}
} {this.props.proudlyDisplayPoweredByUppy && this.renderPoweredByUppy(this.props)}
) } } module.exports = AddFiles