MyCrypto/common/components/GasLimitField.tsx
James Prado 9ef1920fe0 Update dropdowns, inputs, and textareas (#1169)
* Align footer to bottom

* Fix request payment offset padding

* Update request payment padding

* Add new Input and Dropdown components

* Fix offset margins in equiv vals

* Update all send tx inputs & dropdowns

* Update generate wallet dropdowns

* Update inputs & dropdowns for contracts tab

* Add inputs & dropdowns for all but swap tab

* amend

* Fix imports

* inputs are invalid when not disabled or readonly

* Fix offset refresh button

* Add togglable password back to wallet generation

* Update swap inputs, textareas, and dropdowns

* Update any outstanding inputs

* Make UnitDropDown searchable

* unitdropdown searchanble if options > 10

* Fix css issues

* Reset before setting currentTo
2018-03-01 11:53:29 -06:00

38 lines
1.2 KiB
TypeScript

import React from 'react';
import { GasLimitFieldFactory } from './GasLimitFieldFactory';
import translate from 'translations';
import { gasLimitValidator } from 'libs/validators';
import { InlineSpinner } from 'components/ui/InlineSpinner';
import './GasLimitField.scss';
import { Input } from 'components/ui';
interface Props {
customLabel?: string;
disabled?: boolean;
}
export const GasLimitField: React.SFC<Props> = ({ customLabel, disabled }) => (
<GasLimitFieldFactory
withProps={({ gasLimit: { raw }, onChange, readOnly, gasEstimationPending }) => (
<div className="input-group-wrapper AdvancedGas-gas-price">
<label className="input-group">
<div className="input-group-header">
{customLabel ? customLabel : translate('TRANS_gas')}
<div className="flex-spacer" />
<InlineSpinner active={gasEstimationPending} text="Calculating" />
</div>
<Input
className={gasLimitValidator(raw) ? 'is-valid' : 'is-invalid'}
type="number"
placeholder="e.g. 21000"
readOnly={!!readOnly}
value={raw}
onChange={onChange}
disabled={disabled}
/>
</label>
</div>
)}
/>
);