import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; import * as React from 'react'; import { SelectedAssetAmountInput } from '../containers/selected_asset_amount_input'; import { ColorOption } from '../style/theme'; import { AsyncProcessState } from '../types'; import { format } from '../util/format'; import { AmountPlaceholder } from './amount_placeholder'; import { Container, Flex, Text } from './ui'; export interface InstantHeadingProps { selectedAssetAmount?: BigNumber; totalEthBaseAmount?: BigNumber; ethUsdPrice?: BigNumber; quoteRequestState: AsyncProcessState; } const placeholderColor = ColorOption.white; export class InstantHeading extends React.Component { public render(): React.ReactNode { const placeholderAmountToAlwaysShow = this._placeholderAmountToAlwaysShow(); return ( I want to buy {placeholderAmountToAlwaysShow || this._ethAmount()} {placeholderAmountToAlwaysShow || this._dollarAmount()} ); } private _placeholderAmountToAlwaysShow(): React.ReactNode | undefined { if (this.props.quoteRequestState === AsyncProcessState.PENDING) { return ; } if (_.isUndefined(this.props.selectedAssetAmount)) { return ; } return undefined; } private _ethAmount(): React.ReactNode { return ( {format.ethBaseAmount( this.props.totalEthBaseAmount, 4, , )} ); } private _dollarAmount(): React.ReactNode { return ( {format.ethBaseAmountInUsd( this.props.totalEthBaseAmount, this.props.ethUsdPrice, 2, , )} ); } }