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

41 lines
1.4 KiB
TypeScript

import React from 'react';
import translate, { translateRaw } from 'translations';
import { Input, Tooltip } from 'components/ui';
import { TimeBountyFieldFactory } from './TimeBountyFieldFactory';
import Help from 'components/ui/Help';
interface Props {
isReadOnly?: boolean;
}
export const TimeBountyField: React.SFC<Props> = ({ isReadOnly }) => (
<TimeBountyFieldFactory
withProps={({ currentTimeBounty, isValid, onChange, readOnly }) => (
<div className="input-group-wrapper">
<label className="input-group">
<div className="input-group-header">
<span className="ScheduleFields-field-title">
<div className="ScheduleFields-field-title-text">
{translate('SCHEDULE_TIMEBOUNTY')}
</div>
<div className="ScheduleFields-field-title-tooltip">
<Tooltip>{translateRaw('SCHEDULE_TIMEBOUNTY_TOOLTIP')}</Tooltip>
<Help className="ScheduleFields-field-title-help" />
</div>
</span>
</div>
<Input
isValid={isValid}
type="text"
value={currentTimeBounty.raw}
placeholder={translateRaw('SCHEDULE_TIMEBOUNTY_PLACEHOLDER')}
readOnly={!!(isReadOnly || readOnly)}
spellCheck={false}
onChange={onChange}
/>
</label>
</div>
)}
/>
);