isDisabled -> isInputDisabled

This commit is contained in:
Steve Klebanoff
2018-11-20 13:59:09 -08:00
parent 7ad5dbc59d
commit b7eb2e887d
2 changed files with 10 additions and 9 deletions

View File

@@ -22,7 +22,7 @@ export interface ERC20AssetAmountInputProps {
onSelectAssetClick?: (asset?: ERC20Asset) => void; onSelectAssetClick?: (asset?: ERC20Asset) => void;
startingFontSizePx: number; startingFontSizePx: number;
fontColor?: ColorOption; fontColor?: ColorOption;
isDisabled: boolean; isInputDisabled: boolean;
canSelectOtherAsset: boolean; canSelectOtherAsset: boolean;
numberOfAssetsAvailable?: number; numberOfAssetsAvailable?: number;
} }
@@ -51,14 +51,15 @@ export class ERC20AssetAmountInput extends React.Component<ERC20AssetAmountInput
); );
} }
private readonly _renderContentForAsset = (asset: ERC20Asset): React.ReactNode => { private readonly _renderContentForAsset = (asset: ERC20Asset): React.ReactNode => {
const { onChange, ...rest } = this.props; const { onChange, isInputDisabled, ...rest } = this.props;
const amountBorderBottom = this.props.isDisabled ? '' : `1px solid ${transparentWhite}`; const amountBorderBottom = isInputDisabled ? '' : `1px solid ${transparentWhite}`;
const onSymbolClick = this._generateSelectAssetClickHandler(); const onSymbolClick = this._generateSelectAssetClickHandler();
return ( return (
<React.Fragment> <React.Fragment>
<Container borderBottom={amountBorderBottom} display="inline-block"> <Container borderBottom={amountBorderBottom} display="inline-block">
<ScalingAmountInput <ScalingAmountInput
{...rest} {...rest}
isDisabled={isInputDisabled}
textLengthThreshold={this._textLengthThresholdForAsset(asset)} textLengthThreshold={this._textLengthThresholdForAsset(asset)}
maxFontSizePx={this.props.startingFontSizePx} maxFontSizePx={this.props.startingFontSizePx}
onAmountChange={this._handleChange} onAmountChange={this._handleChange}

View File

@@ -23,7 +23,7 @@ interface ConnectedState {
assetBuyer: AssetBuyer; assetBuyer: AssetBuyer;
value?: BigNumber; value?: BigNumber;
asset?: ERC20Asset; asset?: ERC20Asset;
isDisabled: boolean; isInputDisabled: boolean;
numberOfAssetsAvailable?: number; numberOfAssetsAvailable?: number;
affiliateInfo?: AffiliateInfo; affiliateInfo?: AffiliateInfo;
canSelectOtherAsset: boolean; canSelectOtherAsset: boolean;
@@ -44,8 +44,8 @@ type FinalProps = ConnectedProps & SelectedERC20AssetAmountInputProps;
const mapStateToProps = (state: State, _ownProps: SelectedERC20AssetAmountInputProps): ConnectedState => { const mapStateToProps = (state: State, _ownProps: SelectedERC20AssetAmountInputProps): ConnectedState => {
const processState = state.buyOrderState.processState; const processState = state.buyOrderState.processState;
const isEnabled = processState === OrderProcessState.None || processState === OrderProcessState.Failure; const isInputEnabled = processState === OrderProcessState.None || processState === OrderProcessState.Failure;
const isDisabled = !isEnabled; const isInputDisabled = !isInputEnabled;
const selectedAsset = const selectedAsset =
!_.isUndefined(state.selectedAsset) && state.selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20 !_.isUndefined(state.selectedAsset) && state.selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20
? (state.selectedAsset as ERC20Asset) ? (state.selectedAsset as ERC20Asset)
@@ -53,7 +53,7 @@ const mapStateToProps = (state: State, _ownProps: SelectedERC20AssetAmountInputP
const numberOfAssetsAvailable = _.isUndefined(state.availableAssets) ? undefined : state.availableAssets.length; const numberOfAssetsAvailable = _.isUndefined(state.availableAssets) ? undefined : state.availableAssets.length;
const canSelectOtherAsset = const canSelectOtherAsset =
numberOfAssetsAvailable && numberOfAssetsAvailable > 1 numberOfAssetsAvailable && numberOfAssetsAvailable > 1
? isEnabled || processState === OrderProcessState.Success ? isInputEnabled || processState === OrderProcessState.Success
: false; : false;
const assetBuyer = state.providerState.assetBuyer; const assetBuyer = state.providerState.assetBuyer;
@@ -61,7 +61,7 @@ const mapStateToProps = (state: State, _ownProps: SelectedERC20AssetAmountInputP
assetBuyer, assetBuyer,
value: state.selectedAssetUnitAmount, value: state.selectedAssetUnitAmount,
asset: selectedAsset, asset: selectedAsset,
isDisabled, isInputDisabled,
numberOfAssetsAvailable, numberOfAssetsAvailable,
affiliateInfo: state.affiliateInfo, affiliateInfo: state.affiliateInfo,
canSelectOtherAsset, canSelectOtherAsset,
@@ -109,7 +109,7 @@ const mergeProps = (
onChange: (value, asset) => { onChange: (value, asset) => {
connectedDispatch.updateBuyQuote(connectedState.assetBuyer, value, asset, connectedState.affiliateInfo); connectedDispatch.updateBuyQuote(connectedState.assetBuyer, value, asset, connectedState.affiliateInfo);
}, },
isDisabled: connectedState.isDisabled, isInputDisabled: connectedState.isInputDisabled,
numberOfAssetsAvailable: connectedState.numberOfAssetsAvailable, numberOfAssetsAvailable: connectedState.numberOfAssetsAvailable,
canSelectOtherAsset: connectedState.canSelectOtherAsset, canSelectOtherAsset: connectedState.canSelectOtherAsset,
}; };