MyCrypto/common/components/DataField.tsx
HenryNguyen5 8d27d0ba4d Improve form validation (#1772)
* Change gas price validation to be string input based

* Change sanitization to use Nunber

* Have validators use Number over parseFloat

* Fix css validation class

* Add valid css to address field

* Add data field validation

* Remove unused import

* Fix button being hidden on inputs

* Dead code removal

* Unify textarea and input class validation

* Adjust validity styling to only apply after a value has been inputted

* Do not pass custom props to DOM
2018-05-13 14:24:50 -05:00

26 lines
787 B
TypeScript

import { DataFieldFactory } from './DataFieldFactory';
import React from 'react';
import translate from 'translations';
import { donationAddressMap } from 'config';
import { Input } from 'components/ui';
export const DataField: React.SFC<{}> = () => (
<DataFieldFactory
withProps={({ data: { raw }, validData, onChange, readOnly }) => (
<div className="input-group-wrapper">
<label className="input-group">
<div className="input-group-header">{translate('OFFLINE_STEP2_LABEL_6')}</div>
<Input
isValid={validData}
type="text"
placeholder={donationAddressMap.ETH}
value={raw}
readOnly={!!readOnly}
onChange={onChange}
/>
</label>
</div>
)}
/>
);