mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 11:34:26 +00:00
bdaf40a0ce
* Remove title from account, tighten buttons and subtabs. * Send everything button in input. * Request tx to full width, adjust transaction fee spacing. * Fix token balances button spacing. * Fix address identicon flying offscreen. Tighten up identicon, show border even when theres no identicon. * Add isSelfAddress boolean to AddressField, use it on WalletInfo tab. * Use short amount again. * Unused
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import { AmountFieldFactory } from './AmountFieldFactory';
|
|
import { UnitDropDown, SendEverything } from 'components';
|
|
import translate from 'translations';
|
|
import { Input } from 'components/ui';
|
|
|
|
interface Props {
|
|
hasUnitDropdown?: boolean;
|
|
hasSendEverything?: boolean;
|
|
showAllTokens?: boolean;
|
|
customValidator?(rawAmount: string): boolean;
|
|
}
|
|
|
|
export const AmountField: React.SFC<Props> = ({
|
|
hasUnitDropdown,
|
|
hasSendEverything,
|
|
showAllTokens,
|
|
customValidator
|
|
}) => (
|
|
<AmountFieldFactory
|
|
withProps={({ currentValue: { raw }, isValid, onChange, readOnly }) => (
|
|
<div className="AmountField input-group-wrapper">
|
|
<label className="AmountField-group input-group input-group-inline">
|
|
<div className="input-group-header">{translate('SEND_AMOUNT_SHORT')}</div>
|
|
<Input
|
|
className={`input-group-input ${
|
|
isAmountValid(raw, customValidator, isValid) ? '' : 'invalid'
|
|
}`}
|
|
type="number"
|
|
placeholder="1"
|
|
value={raw}
|
|
readOnly={!!readOnly}
|
|
onChange={onChange}
|
|
/>
|
|
{hasSendEverything && <SendEverything />}
|
|
{hasUnitDropdown && <UnitDropDown showAllTokens={showAllTokens} />}
|
|
</label>
|
|
</div>
|
|
)}
|
|
/>
|
|
);
|
|
|
|
const isAmountValid = (
|
|
raw: string,
|
|
customValidator: ((rawAmount: string) => boolean) | undefined,
|
|
isValid: boolean
|
|
) => (customValidator ? customValidator(raw) : isValid);
|