diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-08 13:38:54 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-08 13:38:54 +0800 |
commit | ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18 (patch) | |
tree | b2abb75073906c511854e6ab95be2e8ed5a035b2 /packages/instant/src/components/payment_method_dropdown.tsx | |
parent | f7642c06f0d5662c955ec36e1549d63445a74056 (diff) | |
download | dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.gz dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.bz2 dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.lz dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.xz dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.tar.zst dexon-sol-tools-ecb92a44bc5a4b433f2a673fc77199c7b8a6dc18.zip |
feat: create PaymentMethodDropdown
Diffstat (limited to 'packages/instant/src/components/payment_method_dropdown.tsx')
-rw-r--r-- | packages/instant/src/components/payment_method_dropdown.tsx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/packages/instant/src/components/payment_method_dropdown.tsx b/packages/instant/src/components/payment_method_dropdown.tsx new file mode 100644 index 000000000..09d21e384 --- /dev/null +++ b/packages/instant/src/components/payment_method_dropdown.tsx @@ -0,0 +1,33 @@ +import { BigNumber } from '@0x/utils'; +import * as React from 'react'; + +import { format } from '../util/format'; + +import { Dropdown, DropdownItemConfig } from './ui/dropdown'; + +export interface PaymentMethodDropdownProps { + selectedEthAddress: string; + addressEthBaseAmount: BigNumber; +} + +export class PaymentMethodDropdown extends React.Component<PaymentMethodDropdownProps> { + public static defaultProps = { + selectedEthAddress: '0xa1b2c3d4e5f6g7h8j9k10', + addressEthBaseAmount: new BigNumber(10500000000000000000), + }; + public render(): React.ReactNode { + const { selectedEthAddress, addressEthBaseAmount } = this.props; + const value = format.ethAddress(selectedEthAddress); + const label = format.ethBaseAmount(addressEthBaseAmount) as string; + return <Dropdown value={value} label={label} items={this._getDropdownItemConfigs()} />; + } + private readonly _getDropdownItemConfigs = (): DropdownItemConfig[] => { + const viewOnEtherscan = { + text: 'View on Etherscan', + }; + const copyAddressToClipboard = { + text: 'Copy address to clipboard', + }; + return [viewOnEtherscan, copyAddressToClipboard]; + }; +} |