aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/instant/package.json2
-rw-r--r--packages/instant/src/components/zero_ex_instant.tsx12
-rw-r--r--packages/instant/src/redux/reducer.ts23
-rw-r--r--packages/instant/src/redux/store.ts8
-rw-r--r--packages/instant/src/types.ts8
-rw-r--r--yarn.lock33
6 files changed, 60 insertions, 26 deletions
diff --git a/packages/instant/package.json b/packages/instant/package.json
index 9f97b1caa..2a1c05f2a 100644
--- a/packages/instant/package.json
+++ b/packages/instant/package.json
@@ -64,6 +64,8 @@
"@types/node": "*",
"@types/react": "16.4.7",
"@types/react-dom": "^16.0.8",
+ "@types/react-redux": "^6.0.9",
+ "@types/redux": "^3.6.0",
"awesome-typescript-loader": "^5.2.1",
"copyfiles": "^1.2.0",
"enzyme": "^3.6.0",
diff --git a/packages/instant/src/components/zero_ex_instant.tsx b/packages/instant/src/components/zero_ex_instant.tsx
index 43398cf3b..9ba390be9 100644
--- a/packages/instant/src/components/zero_ex_instant.tsx
+++ b/packages/instant/src/components/zero_ex_instant.tsx
@@ -1,11 +1,15 @@
import * as React from 'react';
+import { Provider } from 'react-redux';
-import { ThemeProvider } from '../style/theme';
+import { store } from '../redux/store';
+import { theme, ThemeProvider } from '../style/theme';
export interface ZeroExInstantProps {}
export const ZeroExInstant: React.StatelessComponent<ZeroExInstantProps> = () => (
- <ThemeProvider>
- <div> ZeroExInstant </div>
- </ThemeProvider>
+ <Provider store={store}>
+ <ThemeProvider theme={theme}>
+ <div> ZeroExInstant </div>
+ </ThemeProvider>
+ </Provider>
);
diff --git a/packages/instant/src/redux/reducer.ts b/packages/instant/src/redux/reducer.ts
new file mode 100644
index 000000000..7efe8aeb0
--- /dev/null
+++ b/packages/instant/src/redux/reducer.ts
@@ -0,0 +1,23 @@
+import * as _ from 'lodash';
+
+import { Action, ActionTypes } from '../types';
+
+export interface State {
+ ethUsdPrice?: string;
+}
+
+export const INITIAL_STATE: State = {
+ ethUsdPrice: undefined,
+};
+
+export function reducer(state: State = INITIAL_STATE, action: Action): State {
+ switch (action.type) {
+ case ActionTypes.UPDATE_ETH_USD_PRICE:
+ return {
+ ...state,
+ ethUsdPrice: action.data,
+ };
+ default:
+ return state;
+ }
+}
diff --git a/packages/instant/src/redux/store.ts b/packages/instant/src/redux/store.ts
new file mode 100644
index 000000000..4d80c0383
--- /dev/null
+++ b/packages/instant/src/redux/store.ts
@@ -0,0 +1,8 @@
+import * as _ from 'lodash';
+import { applyMiddleware, createStore, Store as ReduxStore } from 'redux';
+
+import { reducer, State } from './reducer';
+
+const ONE_SECOND = 1000;
+
+export const store: ReduxStore<State> = createStore(reducer);
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts
new file mode 100644
index 000000000..3ba5a9b94
--- /dev/null
+++ b/packages/instant/src/types.ts
@@ -0,0 +1,8 @@
+export enum ActionTypes {
+ UPDATE_ETH_USD_PRICE,
+}
+
+export interface Action {
+ type: ActionTypes;
+ data?: any;
+}
diff --git a/yarn.lock b/yarn.lock
index eb17d9da9..07d4ce448 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1223,6 +1223,13 @@
"@types/react" "*"
redux "^3.6.0"
+"@types/react-redux@^6.0.9":
+ version "6.0.9"
+ resolved "http://localhost:4873/@types%2freact-redux/-/react-redux-6.0.9.tgz#96aa7f5b0716bcc3bfb36ceaa1223118d509f79a"
+ dependencies:
+ "@types/react" "*"
+ redux "^4.0.0"
+
"@types/react-router-dom@^4.0.4":
version "4.2.6"
resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-4.2.6.tgz#9f7eb3c0e6661a9607d878ff8675cc4ea95cd276"
@@ -1275,7 +1282,7 @@
"@types/redux@^3.6.0":
version "3.6.0"
- resolved "https://registry.yarnpkg.com/@types/redux/-/redux-3.6.0.tgz#f1ebe1e5411518072e4fdfca5c76e16e74c1399a"
+ resolved "http://localhost:4873/@types%2fredux/-/redux-3.6.0.tgz#f1ebe1e5411518072e4fdfca5c76e16e74c1399a"
dependencies:
redux "*"
@@ -12731,18 +12738,7 @@ react-popper@^1.0.0-beta.6:
typed-styles "^0.0.5"
warning "^3.0.0"
-react-redux@^5.0.3:
- version "5.0.7"
- resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.7.tgz#0dc1076d9afb4670f993ffaef44b8f8c1155a4c8"
- dependencies:
- hoist-non-react-statics "^2.5.0"
- invariant "^2.0.0"
- lodash "^4.17.5"
- lodash-es "^4.17.5"
- loose-envify "^1.1.0"
- prop-types "^15.6.0"
-
-react-redux@^5.0.7:
+react-redux@^5.0.3, react-redux@^5.0.7:
version "5.0.7"
resolved "http://localhost:4873/react-redux/-/react-redux-5.0.7.tgz#0dc1076d9afb4670f993ffaef44b8f8c1155a4c8"
dependencies:
@@ -13121,9 +13117,9 @@ redux-devtools-extension@^2.13.2:
version "2.13.2"
resolved "https://registry.yarnpkg.com/redux-devtools-extension/-/redux-devtools-extension-2.13.2.tgz#e0f9a8e8dfca7c17be92c7124958a3b94eb2911d"
-redux@*:
+redux@*, redux@^4.0.0:
version "4.0.0"
- resolved "https://registry.yarnpkg.com/redux/-/redux-4.0.0.tgz#aa698a92b729315d22b34a0553d7e6533555cc03"
+ resolved "http://localhost:4873/redux/-/redux-4.0.0.tgz#aa698a92b729315d22b34a0553d7e6533555cc03"
dependencies:
loose-envify "^1.1.0"
symbol-observable "^1.2.0"
@@ -13137,13 +13133,6 @@ redux@^3.6.0:
loose-envify "^1.1.0"
symbol-observable "^1.0.3"
-redux@^4.0.0:
- version "4.0.0"
- resolved "http://localhost:4873/redux/-/redux-4.0.0.tgz#aa698a92b729315d22b34a0553d7e6533555cc03"
- dependencies:
- loose-envify "^1.1.0"
- symbol-observable "^1.2.0"
-
regenerate@^1.2.1:
version "1.3.3"
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f"