import * as React from 'react' ; import SimpleButton , { SimpleButtonProps } from '../SimpleButton/SimpleButton' ; import { CSS_PREFIX } from '../../constants' ; import './UploadButton.less' ; interface BaseProps { /**
     * The className which should be added.
     */ className ? : string ; /**
     * Object of props that should be passed to the input field.
     */ inputProps ? : React . InputHTMLAttributes < HTMLInputElement > ; /**
     * The onChange handler for the upload input field.
     */ onChange ? : ( event : React . ChangeEvent < HTMLInputElement > ) => void ; } export type UploadButtonProps = BaseProps & SimpleButtonProps ; class extends React . Component class UploadButton extends React . Component < UploadButtonProps > { private _className = `${ CSS_PREFIX }uploadbutton` ; /**
     * The render function.
     */ render ( ) { const { className , children , onChange , inputProps , ... passThroughProps } = this . props ; const finalClassName = className ? `${ className } ${ this . _className }` : this . _className ; const button = < SimpleButton { ... passThroughProps } / > ; return ( < div className = { finalClassName } > { children || button } < input type = "file" onChange = { onChange } { ... inputProps } /> < /div>); } } export default UploadButton ;