aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-24 05:09:44 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-24 05:13:06 +0800
commit864f89c535cf68a9325f27eae7f49a088c481120 (patch)
tree20e40e1a5bf46f8b7e408e5223979cfa7a2994ff /packages/instant
parentc5014af7fe7b06c01edfc677da48628d4972e298 (diff)
downloaddexon-0x-contracts-864f89c535cf68a9325f27eae7f49a088c481120.tar.gz
dexon-0x-contracts-864f89c535cf68a9325f27eae7f49a088c481120.tar.zst
dexon-0x-contracts-864f89c535cf68a9325f27eae7f49a088c481120.zip
chore: incorportate pr feedback
Diffstat (limited to 'packages/instant')
-rw-r--r--packages/instant/src/components/buy_button.tsx2
-rw-r--r--packages/instant/src/components/zero_ex_instant.tsx8
-rw-r--r--packages/instant/src/constants.ts1
-rw-r--r--packages/instant/src/index.umd.ts3
4 files changed, 8 insertions, 6 deletions
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index 3ef7c1f5c..adc32f071 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -24,7 +24,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
onBuyFailure: util.boundNoop,
};
public render(): React.ReactNode {
- const shouldDisableButton = _.isUndefined(this.props.buyQuote);
+ const shouldDisableButton = _.isUndefined(this.props.buyQuote) || _.isUndefined(this.props.assetBuyer);
return (
<Container padding="20px" width="100%">
<Button width="100%" onClick={this._handleClick} isDisabled={shouldDisableButton}>
diff --git a/packages/instant/src/components/zero_ex_instant.tsx b/packages/instant/src/components/zero_ex_instant.tsx
index 142e74dae..ffa5a8250 100644
--- a/packages/instant/src/components/zero_ex_instant.tsx
+++ b/packages/instant/src/components/zero_ex_instant.tsx
@@ -31,7 +31,7 @@ export interface ZeroExInstantOptionalProps {
}
export class ZeroExInstant extends React.Component<ZeroExInstantProps> {
- public store: Store;
+ private readonly _store: Store;
private static _mergeInitialStateWithProps(props: ZeroExInstantProps, state: State = INITIAL_STATE): State {
// Create merged object such that properties in props override default settings
const optionalPropsWithDefaults: ZeroExInstantOptionalProps = {
@@ -58,14 +58,14 @@ export class ZeroExInstant extends React.Component<ZeroExInstantProps> {
}
constructor(props: ZeroExInstantProps) {
super(props);
- this.store = store.create(ZeroExInstant._mergeInitialStateWithProps(this.props, INITIAL_STATE));
+ this._store = store.create(ZeroExInstant._mergeInitialStateWithProps(this.props, INITIAL_STATE));
// tslint:disable-next-line:no-floating-promises
- asyncData.fetchAndDispatchToStore(this.store);
+ asyncData.fetchAndDispatchToStore(this._store);
}
public render(): React.ReactNode {
return (
- <Provider store={this.store}>
+ <Provider store={this._store}>
<SelectedAssetThemeProvider>
<ZeroExInstantContainer />
</SelectedAssetThemeProvider>
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index 7f4c5a058..31491c80a 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -1,3 +1,4 @@
import { BigNumber } from '@0x/utils';
export const BIG_NUMBER_ZERO = new BigNumber(0);
export const ethDecimals = 18;
+export const DEFAULT_ZERO_EX_CONTAINER_SELECTOR = '#zeroExInstantContainer';
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts
index fe78ce401..f648b37f2 100644
--- a/packages/instant/src/index.umd.ts
+++ b/packages/instant/src/index.umd.ts
@@ -1,8 +1,9 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';
+import { DEFAULT_ZERO_EX_CONTAINER_SELECTOR } from './constants';
import { ZeroExInstant, ZeroExInstantProps } from './index';
-export const render = (props: ZeroExInstantProps, selector: string = '#zeroExInstantContainer') => {
+export const render = (props: ZeroExInstantProps, selector: string = DEFAULT_ZERO_EX_CONTAINER_SELECTOR) => {
ReactDOM.render(React.createElement(ZeroExInstant, props), document.querySelector(selector));
};