aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-16 08:06:28 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-16 08:06:28 +0800
commitac3bfdfe5ffc4fc49b88fbad062e1d562987e728 (patch)
treef6e4f4bfcfcecc2c28061ec4b84940f13ab71d3e /packages/instant/src
parentfcf345144835cf142da2cbca544151100791700f (diff)
downloaddexon-sol-tools-ac3bfdfe5ffc4fc49b88fbad062e1d562987e728.tar
dexon-sol-tools-ac3bfdfe5ffc4fc49b88fbad062e1d562987e728.tar.gz
dexon-sol-tools-ac3bfdfe5ffc4fc49b88fbad062e1d562987e728.tar.bz2
dexon-sol-tools-ac3bfdfe5ffc4fc49b88fbad062e1d562987e728.tar.lz
dexon-sol-tools-ac3bfdfe5ffc4fc49b88fbad062e1d562987e728.tar.xz
dexon-sol-tools-ac3bfdfe5ffc4fc49b88fbad062e1d562987e728.tar.zst
dexon-sol-tools-ac3bfdfe5ffc4fc49b88fbad062e1d562987e728.zip
Put boundNoop in a util file
Diffstat (limited to 'packages/instant/src')
-rw-r--r--packages/instant/src/components/amount_input.tsx3
-rw-r--r--packages/instant/src/components/asset_amount_input.tsx3
-rw-r--r--packages/instant/src/components/buy_button.tsx9
-rw-r--r--packages/instant/src/util/util.ts5
4 files changed, 13 insertions, 7 deletions
diff --git a/packages/instant/src/components/amount_input.tsx b/packages/instant/src/components/amount_input.tsx
index 5b81a3d68..7644f5f67 100644
--- a/packages/instant/src/components/amount_input.tsx
+++ b/packages/instant/src/components/amount_input.tsx
@@ -3,6 +3,7 @@ import * as _ from 'lodash';
import * as React from 'react';
import { ColorOption } from '../style/theme';
+import { util } from '../util/util';
import { Container, Input } from './ui';
@@ -15,7 +16,7 @@ export interface AmountInputProps {
export class AmountInput extends React.Component<AmountInputProps> {
public static defaultProps = {
- onChange: _.noop.bind(_),
+ onChange: util.boundNoop,
};
public render(): React.ReactNode {
const { fontColor, fontSize, value } = this.props;
diff --git a/packages/instant/src/components/asset_amount_input.tsx b/packages/instant/src/components/asset_amount_input.tsx
index 72bcfb8fb..7c6b03ee9 100644
--- a/packages/instant/src/components/asset_amount_input.tsx
+++ b/packages/instant/src/components/asset_amount_input.tsx
@@ -5,6 +5,7 @@ import * as React from 'react';
import { assetMetaData } from '../data/asset_meta_data';
import { ColorOption } from '../style/theme';
+import { util } from '../util/util';
import { AmountInput, AmountInputProps } from './amount_input';
import { Container, Text } from './ui';
@@ -16,7 +17,7 @@ export interface AssetAmountInputProps extends AmountInputProps {
export class AssetAmountInput extends React.Component<AssetAmountInputProps> {
public static defaultProps = {
- onChange: _.noop.bind(_),
+ onChange: util.boundNoop,
};
public render(): React.ReactNode {
const { assetData, onChange, ...rest } = this.props;
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index e9466619e..0706817c9 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -4,6 +4,7 @@ import * as React from 'react';
import { ColorOption } from '../style/theme';
import { assetBuyer } from '../util/asset_buyer';
+import { util } from '../util/util';
import { web3Wrapper } from '../util/web3_wrapper';
import { Button, Container, Text } from './ui';
@@ -16,13 +17,11 @@ export interface BuyButtonProps {
text: string;
}
-const boundNoop = _.noop.bind(_);
-
export class BuyButton extends React.Component<BuyButtonProps> {
public static defaultProps = {
- onClick: boundNoop,
- onBuySuccess: boundNoop,
- onBuyFailure: boundNoop,
+ onClick: util.boundNoop,
+ onBuySuccess: util.boundNoop,
+ onBuyFailure: util.boundNoop,
};
public render(): React.ReactNode {
const shouldDisableButton = _.isUndefined(this.props.buyQuote);
diff --git a/packages/instant/src/util/util.ts b/packages/instant/src/util/util.ts
new file mode 100644
index 000000000..232a86850
--- /dev/null
+++ b/packages/instant/src/util/util.ts
@@ -0,0 +1,5 @@
+import * as _ from 'lodash';
+
+export const util = {
+ boundNoop: _.noop.bind(_),
+};