import React from 'react'; import translate from 'translations'; interface Props { value: string; onChange?(value: string): void | null; } export default class GasField extends React.Component { public render() { const { value, onChange } = this.props; const isReadonly = !onChange; return (
0 ? 'is-valid' : 'is-invalid'}`} type="text" placeholder="21000" disabled={isReadonly} value={value} onChange={this.onChange} />
); } public onChange = (e: React.SyntheticEvent) => { if (this.props.onChange) { this.props.onChange((e.target as HTMLInputElement).value); } }; }