Skip to content
This repository has been archived by the owner on Oct 3, 2018. It is now read-only.

Commit

Permalink
Update redux
Browse files Browse the repository at this point in the history
  • Loading branch information
01dr committed Jan 20, 2018
1 parent d022721 commit 72bdf55
Show file tree
Hide file tree
Showing 8 changed files with 198 additions and 24 deletions.
21 changes: 19 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"serve": "babel-node tools/serveDist.js",
"lint:js": "esw src tools --color",
"lint:css": "stylelint 'src/**/*.css'",
"lint:all": "concurrently -r \"yarn run lint:js\" \"yarn run lint:css\"",
"lint:all": "concurrently \"yarn run lint:js\" \"yarn run lint:css\"",
"test": "jest",
"test:coverage": "jest --coverage",
"test:watch": "jest --watch",
Expand All @@ -24,25 +24,38 @@
"dependencies": {
"file-loader": "^1.1.6",
"normalize.css": "^7.0.0",
"object-assign": "^4.1.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"url-loader": "^0.6.2"
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-saga": "^0.16.0",
"redux-seamless-immutable": "^0.3.2",
"seamless-immutable": "^7.1.2",
"url-loader": "^0.6.2",
"whatwg-fetch": "^2.0.3"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-jest": "^22.1.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-constant-elements": "^6.23.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.12",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-react-hmre": "^1.1.1",
"babel-preset-stage-1": "^6.24.1",
"browser-sync": "^2.23.5",
"caniuse-lite": "^1.0.30000792",
"chalk": "^2.3.0",
"concurrently": "^3.5.1",
"connect-history-api-fallback": "^1.5.0",
"css-loader": "^0.28.9",
"dotenv-webpack": "^1.5.4",
Expand All @@ -56,6 +69,7 @@
"html-webpack-plugin": "^2.30.1",
"jest": "^22.1.3",
"jest-cli": "^22.1.3",
"postcss": "^6.0.16",
"postcss-assets": "^5.0.0",
"postcss-clearfix": "^2.0.1",
"postcss-cssnext": "^3.0.2",
Expand Down Expand Up @@ -106,6 +120,8 @@
"stage-1"
],
"plugins": [
"transform-runtime",
"transform-react-jsx",
"transform-react-constant-elements",
"transform-react-remove-prop-types"
]
Expand Down Expand Up @@ -170,6 +186,7 @@
"no-underscore-dangle": 0,
"no-use-before-define": 0,
"eol-last": 0,
"no-shadow": 0,
"quotes": [
2,
"single"
Expand Down
Binary file removed src/containers/App/images/chvrches.jpg
Binary file not shown.
33 changes: 26 additions & 7 deletions src/containers/App/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import React from 'react';
import { connect } from 'react-redux';
import s from './styles.css';
import { increment, decrement } from '../../redux/modules/app/app';

const Main = () => (
<div className={s.main}>
<img src={require('./images/chvrches.jpg')}/>
<div>Hello, world!</div>
</div>
);
const Main = (props) => {
const {
counter,
increment,
decrement,
} = props;

export default Main;
return (
<div className={s.main}>
<div className={s.counterWrapper}>
<button className={s.button} type="button" onClick={() => decrement()}>-</button>
<span className={s.counter}>counter: {counter}</span>
<button className={s.button} type="button" onClick={() => increment()}>+</button>
</div>
</div>
);
};

export default connect(
(state) => state.app.app,
{
increment,
decrement
}
)(Main);
12 changes: 6 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import React from 'react';
import ReactDOM from 'react-dom';
// import { Provider } from 'react-redux';
import { Provider } from 'react-redux';
import { AppContainer } from 'react-hot-loader';

import 'normalize.css';
import './assets/main.css';
import './assets/fonts/Roboto/stylesheet.css';

// import configureStore from './redux/configureStore';
import configureStore from './redux/configureStore';
import App from './containers/App';

// const store = configureStore({});

console.info(process.env.API_HOST);
const store = configureStore({});

const render = (Component) => {
ReactDOM.render(
<AppContainer>
<Component/>
<Provider store={store}>
<Component/>
</Provider>
</AppContainer>,
document.getElementById('app')
);
Expand Down
4 changes: 2 additions & 2 deletions src/utils/fetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ export const putFn = (path, body) =>
*/

export const del = (path) =>
(apiFetch(path), {
(apiFetch(path, {
method: 'DELETE'
});
}));
1 change: 1 addition & 0 deletions tools/webpack/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const entry = [
path.resolve(__dirname, '../../src/webpack-public-path'),
'react-hot-loader/patch',
'webpack-hot-middleware/client?reload=true',
'babel-polyfill',
path.resolve(__dirname, '../../src/index.js')
];
const target = 'web';
Expand Down
5 changes: 4 additions & 1 deletion tools/webpack/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import HtmlWebpackPlugin from 'html-webpack-plugin';
import Dotenv from 'dotenv-webpack';
import path from 'path';

const entry = path.resolve(__dirname, '../../src/index');
const entry = [
'babel-polyfill',
path.resolve(__dirname, '../../src/index')
];
const target = 'web';
const output = {
path: path.resolve(__dirname, '../../dist'),
Expand Down
Loading

0 comments on commit 72bdf55

Please sign in to comment.