From 52a6e6357b521e3e290103ba31ab91e9ede79d5c Mon Sep 17 00:00:00 2001 From: fragosti Date: Thu, 19 Jul 2018 06:57:00 -0700 Subject: Add lifecycle messages --- .../ts/containers/inputs/eth_amount_input.ts | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 packages/website/ts/containers/inputs/eth_amount_input.ts (limited to 'packages/website/ts/containers') 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 = connect(mapStateToProps)( + EthAmountInputComponent, +); -- cgit v1.2.3