Skip to content

Commit e3da845

Browse files
committed
add client
1 parent 6317473 commit e3da845

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+340
-17
lines changed

.gitignore

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2-
#
3-
# If you find yourself ignoring temporary files generated by your text editor
4-
# or operating system, you probably want to add a global ignore instead:
5-
# git config --global core.excludesfile '~/.gitignore_global'
6-
7-
# Ignore bundler config.
8-
/.bundle
9-
10-
# Ignore all logfiles and tempfiles.
11-
/log/*
12-
/tmp/*
13-
!/log/.keep
14-
!/tmp/.keep
15-
16-
# Ignore Byebug command history file.
17-
.byebug_history
181
.idea/

client/.babelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"react",
5+
"stage-0"
6+
]
7+
}

client/.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

client/.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
6+
# testing
7+
coverage
8+
9+
# production
10+
public
11+
12+
# misc
13+
.DS_Store
14+
.env
15+
npm-debug.log
16+
.idea

client/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6

client/README.md

Lines changed: 17 additions & 0 deletions

client/assets/favicon.ico

24.3 KB
Binary file not shown.

client/package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "client",
3+
"version": "0.1.0",
4+
"private": true,
5+
"jest": {
6+
"snapshotSerializers": [
7+
"<rootDir>/node_modules/enzyme-to-json/serializer"
8+
]
9+
},
10+
"scripts": {
11+
"build": "shx rm -rf public/** && NODE_ENV=production webpack -p --progress",
12+
"start": "webpack-dev-server",
13+
"test": "NODE_ENV=test jest"
14+
},
15+
"dependencies": {
16+
"babel-polyfill": "^6.23.0",
17+
"react": "^15.4.2",
18+
"react-dom": "^15.4.2",
19+
"react-redux": "^5.0.3",
20+
"react-router": "~3.0.2",
21+
"react-router-redux": "^4.0.8",
22+
"redux": "^3.6.0",
23+
"redux-json-api": "^1.7.0",
24+
"redux-thunk": "^2.2.0"
25+
},
26+
"devDependencies": {
27+
"babel-loader": "^6.4.0",
28+
"babel-preset-es2015": "^6.22.0",
29+
"babel-preset-react": "^6.23.0",
30+
"babel-preset-stage-0": "^6.22.0",
31+
"copy-webpack-plugin": "^4.0.1",
32+
"css-loader": "^0.26.4",
33+
"enzyme": "^2.7.1",
34+
"enzyme-to-json": "^1.5.0",
35+
"extract-text-webpack-plugin": "^2.1.0",
36+
"html-webpack-plugin": "^2.28.0",
37+
"jest": "^19.0.2",
38+
"node-sass": "^4.5.0",
39+
"react-addons-test-utils": "^15.4.2",
40+
"sass-loader": "^6.0.3",
41+
"shx": "^0.2.2",
42+
"style-loader": "^0.13.2",
43+
"webpack": "^2.2.1",
44+
"webpack-config-utils": "^2.3.0",
45+
"webpack-dev-server": "^2.4.1"
46+
}
47+
}

client/src/components/App.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
3+
const App = (props) => (
4+
<div>
5+
<h1>Perfectly simple Webpack 2 setup</h1>
6+
{props.children}
7+
</div>
8+
);
9+
10+
export default App;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React, { Component, PropTypes } from 'react';
2+
import { readEndpoint } from 'redux-json-api';
3+
import { connect } from 'react-redux';
4+
5+
class PostList extends React.Component {
6+
componentWillMount() {
7+
this.props.fetchPosts();
8+
}
9+
10+
render() {
11+
return (
12+
<div>
13+
{this.props.posts.data.map(post =>
14+
<div key={post.id}>
15+
{post.attributes.title}
16+
</div>
17+
)}
18+
</div>
19+
);
20+
}
21+
};
22+
23+
const mapStateToProps = (state) => ({
24+
posts: state.api.posts || {data: []},
25+
});
26+
27+
const mapDispatchToProps = (dispatch) => ({
28+
fetchPosts: () => dispatch(readEndpoint('posts?include=category')),
29+
});
30+
31+
export default connect(mapStateToProps, mapDispatchToProps)(PostList);
32+
33+
// https://github.com/dixieio/redux-json-api/issues/47
34+
// https://github.com/dixieio/redux-json-api/issues/83
35+

0 commit comments

Comments
 (0)