Skip to content

Commit ae7d236

Browse files
committed
Copy step-2 code from step-1
1 parent ec95824 commit ae7d236

File tree

12 files changed

+160
-0
lines changed

12 files changed

+160
-0
lines changed

step-2/.babelrc

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

step-2/.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
webpack.config.js
3+
public
4+
README.md

step-2/.eslintrc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"browser": true,
5+
"node": true,
6+
"es6": true
7+
},
8+
"plugins": [
9+
"react"
10+
],
11+
"ecmaFeatures": {
12+
"jsx": true,
13+
"modules": true
14+
},
15+
"rules": {
16+
"react/display-name": 0,
17+
"react/forbid-prop-types": 1,
18+
"react/jsx-boolean-value": 1,
19+
"react/jsx-closing-bracket-location": 1,
20+
"react/jsx-curly-spacing": 1,
21+
"react/jsx-handler-names": 1,
22+
"react/jsx-indent-props": 1,
23+
"react/jsx-key": 1,
24+
"react/jsx-max-props-per-line": 1,
25+
"react/jsx-no-bind": 1,
26+
"react/jsx-no-duplicate-props": 1,
27+
"react/jsx-no-literals": 1,
28+
"react/jsx-no-undef": 1,
29+
"react/jsx-pascal-case": 1,
30+
"react/jsx-quotes": 1,
31+
"react/jsx-sort-prop-types": 1,
32+
"react/jsx-sort-props": 1,
33+
"react/jsx-uses-react": 1,
34+
"react/jsx-uses-vars": 1,
35+
"react/no-danger": 1,
36+
"react/no-did-mount-set-state": 1,
37+
"react/no-did-update-set-state": 1,
38+
"react/no-direct-mutation-state": 1,
39+
"react/no-multi-comp": 1,
40+
"react/no-set-state": 1,
41+
"react/no-unknown-property": 1,
42+
"react/prefer-es6-class": 0,
43+
"react/prop-types": 1,
44+
"react/react-in-jsx-scope": 1,
45+
"react/require-extension": 1,
46+
"react/self-closing-comp": 1,
47+
"react/sort-comp": 1,
48+
"react/wrap-multilines": 1
49+
}
50+
}

step-2/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "react-workshop",
3+
"description": "React Workshop",
4+
"version": "0.1.0",
5+
"dependencies": {
6+
"react": "0.14.7",
7+
"react-dom": "0.14.7"
8+
},
9+
"devDependencies": {
10+
"webpack": "1.12.9",
11+
"webpack-dev-server": "1.14.0",
12+
"babel-loader": "6.2.0",
13+
"babel-preset-es2015": "6.1.18",
14+
"babel-preset-react": "6.1.18",
15+
"babel-register": "6.3.13",
16+
"eslint": "1.10.3",
17+
"eslint-plugin-react": "3.11.3"
18+
},
19+
"scripts": {
20+
"lint": "eslint src",
21+
"bundle": "webpack -p --colors --progress",
22+
"start": "webpack-dev-server -d --colors --inline --content-base public",
23+
"build": "npm run lint && npm run bundle"
24+
}
25+
}

step-2/public/css/main.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
font-family: 'Roboto', sans-serif;
3+
}

step-2/public/img/chevrol-bel-air.png

28.6 KB
Loading

step-2/public/img/react.png

13.2 KB
Loading

step-2/public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8"/>
5+
<title>React Workshop</title>
6+
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
7+
<link href="./css/main.css" rel="stylesheet" type="text/css">
8+
<link rel="icon" type="image/png" href="/img/react.png">
9+
</head>
10+
<body>
11+
<h1>Wines</h1>
12+
13+
<div id="main"></div>
14+
15+
<script src="/js/bundle.js"></script>
16+
</body>
17+
</html>

step-2/public/js/.gitkeep

Whitespace-only changes.

step-2/src/app.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import Wine from './components/wine';
5+
6+
ReactDOM.render(
7+
<Wine name="Château Chevrol Bel Air"/>,
8+
document.getElementById('main')
9+
);

step-2/src/components/wine.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
3+
const WineStyle = {
4+
padding: 8,
5+
boxShadow: '0 1px 6px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.12)'
6+
};
7+
8+
const Wine = React.createClass({
9+
propTypes: {
10+
name: React.PropTypes.string
11+
},
12+
13+
render() {
14+
return (
15+
<div style={WineStyle}>
16+
{this.props.name}
17+
</div>
18+
);
19+
}
20+
});
21+
22+
export default Wine;

step-2/webpack.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var webpack = require('webpack');
2+
3+
module.exports = {
4+
output: {
5+
path: './public/js/',
6+
publicPath: '/js/',
7+
filename: 'bundle.js'
8+
},
9+
entry: {
10+
app: ['./src/app.js']
11+
},
12+
resolve: {
13+
extensions: ['', '.js', '.jsx']
14+
},
15+
module: {
16+
loaders: [
17+
{
18+
test: /\.js$/,
19+
exclude: /node_modules/,
20+
loader: 'babel',
21+
query: {
22+
presets: ['react', 'es2015']
23+
}
24+
}
25+
]
26+
}
27+
};

0 commit comments

Comments
 (0)