35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import { AddressFieldFactory } from './AddressFieldFactory';
|
|
import { donationAddressMap } from 'config';
|
|
import translate from 'translations';
|
|
import { Input } from 'components/ui';
|
|
|
|
interface Props {
|
|
isReadOnly?: boolean;
|
|
isSelfAddress?: boolean;
|
|
}
|
|
|
|
export const AddressField: React.SFC<Props> = ({ isReadOnly, isSelfAddress }) => (
|
|
<AddressFieldFactory
|
|
isSelfAddress={isSelfAddress}
|
|
withProps={({ currentTo, isValid, onChange, readOnly }) => (
|
|
<div className="input-group-wrapper">
|
|
<label className="input-group">
|
|
<div className="input-group-header">
|
|
{translate(isSelfAddress ? 'X_ADDRESS' : 'SEND_ADDR')}
|
|
</div>
|
|
<Input
|
|
className={`input-group-input ${isValid ? '' : 'invalid'}`}
|
|
type="text"
|
|
value={currentTo.raw}
|
|
placeholder={donationAddressMap.ETH}
|
|
readOnly={!!(isReadOnly || readOnly)}
|
|
spellCheck={false}
|
|
onChange={onChange}
|
|
/>
|
|
</label>
|
|
</div>
|
|
)}
|
|
/>
|
|
);
|