diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2018-07-22 18:45:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-22 18:45:21 +0800 |
commit | 0e72b67865ce7f891283ed9d21bd36cfaab4e645 (patch) | |
tree | 653d1f39f5819e7136f6b673ae75015c09a7aae0 /packages/website/ts/containers | |
parent | b987eebf215391a8af9cff995c7f6c4a6e434bd9 (diff) | |
parent | ff12aafc0fa30cfbd1c59f9a2fc3491395e2cdab (diff) | |
download | dexon-0x-contracts-0e72b67865ce7f891283ed9d21bd36cfaab4e645.tar.gz dexon-0x-contracts-0e72b67865ce7f891283ed9d21bd36cfaab4e645.tar.zst dexon-0x-contracts-0e72b67865ce7f891283ed9d21bd36cfaab4e645.zip |
Merge pull request #895 from 0xProject/feature/website/send-eth-from-portal
Send Ether from Portal
Diffstat (limited to 'packages/website/ts/containers')
-rw-r--r-- | packages/website/ts/containers/inputs/eth_amount_input.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/packages/website/ts/containers/inputs/eth_amount_input.ts b/packages/website/ts/containers/inputs/eth_amount_input.ts new file mode 100644 index 000000000..9ef903b55 --- /dev/null +++ b/packages/website/ts/containers/inputs/eth_amount_input.ts @@ -0,0 +1,36 @@ +import { BigNumber } from '@0xproject/utils'; +import { Web3Wrapper } from '@0xproject/web3-wrapper'; +import * as React from 'react'; +import { connect } from 'react-redux'; +import { State } from 'ts/redux/reducer'; +import { ValidatedBigNumberCallback } from 'ts/types'; +import { constants } from 'ts/utils/constants'; + +import { EthAmountInput as EthAmountInputComponent } from 'ts/components/inputs/eth_amount_input'; + +interface EthAmountInputProps { + label?: string; + amount?: BigNumber; + hintText?: string; + onChange: ValidatedBigNumberCallback; + onErrorMsgChange?: (errorMsg: React.ReactNode) => void; + shouldShowIncompleteErrs: boolean; + shouldCheckBalance: boolean; + shouldShowErrs?: boolean; + shouldShowUnderline?: boolean; + style?: React.CSSProperties; + labelStyle?: React.CSSProperties; + inputHintStyle?: React.CSSProperties; +} + +interface ConnectedState { + balance: BigNumber; +} + +const mapStateToProps = (state: State, _ownProps: EthAmountInputProps): ConnectedState => ({ + balance: Web3Wrapper.toUnitAmount(state.userEtherBalanceInWei, constants.DECIMAL_PLACES_ETH), +}); + +export const EthAmountInput: React.ComponentClass<EthAmountInputProps> = connect(mapStateToProps)( + EthAmountInputComponent, +); |