Skip to content

Commit 3ff1c47

Browse files
committed
Boilerplate was added
1 parent 91a371a commit 3ff1c47

15 files changed

+221
-7
lines changed

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#airbnb
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
end_of_line = lf

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

.eslintrc.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
extends: ['airbnb', '@mate-academy/eslint-config'],
3+
env: {
4+
commonjs: true,
5+
node: true,
6+
es6: true,
7+
browser: true
8+
},
9+
parserOptions: {
10+
sourceType: "module"
11+
},
12+
"globals": {
13+
it: false
14+
},
15+
rules: {
16+
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
17+
'no-console': 'off',
18+
"no-param-reassign": 0,
19+
20+
"no-shadow": ["error", { "builtinGlobals": false }],
21+
"react/destructuring-assignment": 0,
22+
}
23+
};

.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.idea
2+
node_modules
3+
.DS_Store
4+
yarn.lock
5+
package-lock.json
6+
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
build

.stylelintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

.stylelintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
extends: "@mate-academy/stylelint-config",
3+
rules: {}
4+
};

README.md

+46-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,55 @@
11
# React static list of posts
22

3-
By using [posts.js](posts.js), [users.js](users.js), and [comments.js](comments.js) as modules to your React application, create and display a list of posts with the following data on each:
3+
## Demo link
4+
5+
Add link here: `[DEMO LINK](https://<your_account>.github.io/<repo_name>/)`
6+
7+
8+
## Task
9+
10+
By using [posts.js](./src/api/posts.js), [users.js](./src/api/users.js), and [comments.js](./src/api/comments.js) as modules to your React application, create and display a list of posts with the following data on each:
411

512
1) the title of the post;
613
2) the text (body) of the post;
714
3) the name, email, and address of the author of the post;
815
4) sublist of the post comments, including the name and email of the author of each comment as well as the comment itself.
916

1017
Create and use five components: `PostList`, `Post`, `User`, `CommentList`, and `Comment`. You can use the `User` component from both `Post` (with address) and `Comment` (without providing any address).
18+
19+
20+
## Workflow
21+
22+
- Fork the repository with task
23+
- Clone forked repository
24+
```bash
25+
git clone [email protected]:<user_name>/<task_repository>.git
26+
```
27+
- Run `npm install` to install dependencies.
28+
- Then develop
29+
30+
31+
## Development mode
32+
33+
- Run `npm start` to start development server on `http://localhost:3000`
34+
When you run server the command line window will no longer be available for
35+
writing commands until you stop server (`ctrl + c`). All other commands you
36+
need to run in new command line window.
37+
- Follow [HTML, CSS styleguide](https://mate-academy.github.io/style-guides/htmlcss.html)
38+
- Follow [the simplified JS styleguide](https://mate-academy.github.io/style-guides/javascript-standard-modified)
39+
- run `npm run lint` to check code style
40+
- When you finished add correct `homepage` to `package.json` and run `npm run deploy`
41+
- Add links to your demo in readme.md.
42+
- `[DEMO LINK](https://<your_account>.github.io/<repo_name>/)` - this will be a
43+
link to your index.html
44+
- Commit and push all recent changes.
45+
- Create `Pull Request` from forked repo `(<branch_name>)` to original repo
46+
(`master`).
47+
- Add a link at `PR` to Google Spreadsheets.
48+
49+
50+
## Project structure
51+
52+
- `src/` - directory for css, js, image, fonts files
53+
- `build/` - directory for built pages
54+
55+
You should be writing code in `src/` directory.

package.json

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"homepage": "https://mate-academy.github.io/react_static-list-of-posts",
3+
"name": "react_static-list-of-posts",
4+
"version": "0.1.0",
5+
"private": true,
6+
"keywords": [],
7+
"author": "Mate Academy",
8+
"license": "GPL-3.0",
9+
"dependencies": {
10+
"prop-types": "^15.7.2",
11+
"react": "^16.8.6",
12+
"react-dom": "^16.8.6",
13+
"react-scripts": "3.0.1"
14+
},
15+
"devDependencies": {
16+
"@mate-academy/eslint-config": "*",
17+
"@mate-academy/stylelint-config": "*",
18+
"eslint": "^5.3.0",
19+
"eslint-config-airbnb": "^17.1.0",
20+
"eslint-plugin-import": "^2.17.3",
21+
"eslint-plugin-jsx-a11y": "^6.2.1",
22+
"eslint-plugin-node": "^8.0.1",
23+
"eslint-plugin-react": "^7.13.0",
24+
"gh-pages": "^2.0.1",
25+
"stylelint": "^10.0.0"
26+
},
27+
"scripts": {
28+
"start": "react-scripts start",
29+
"build": "react-scripts build",
30+
"test": "react-scripts test",
31+
"eject": "react-scripts eject",
32+
"lint": "eslint --ext .jsx,.js ./src/",
33+
"predeploy": "npm run build",
34+
"deploy": "gh-pages -d build"
35+
},
36+
"eslintConfig": {
37+
"extends": "react-app"
38+
},
39+
"lint-staged": {
40+
"linters": {
41+
"*.css": [
42+
"stylelint",
43+
"git add"
44+
],
45+
"*.js": [
46+
"eslint",
47+
"git add"
48+
]
49+
},
50+
"ignore": []
51+
},
52+
"browserslist": {
53+
"production": [
54+
">0.2%",
55+
"not dead",
56+
"not op_mini all"
57+
],
58+
"development": [
59+
"last 1 chrome version",
60+
"last 1 firefox version",
61+
"last 1 safari version"
62+
]
63+
}
64+
}

public/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<title>Static list of posts</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
</body>
11+
</html>

src/App.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.App {
2+
text-align: center;
3+
}

src/App.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
3+
import './App.css';
4+
5+
import posts from './api/posts';
6+
import comments from './api/comments';
7+
import users from './api/users';
8+
9+
const App = () => (
10+
<div className="App">
11+
<h1>Static list of posts</h1>
12+
13+
<p>
14+
<span>posts: </span>
15+
{posts.length}
16+
</p>
17+
18+
<p>
19+
<span>comments: </span>
20+
{comments.length}
21+
</p>
22+
23+
<p>
24+
<span>Users: </span>
25+
{users.length}
26+
</p>
27+
</div>
28+
);
29+
30+
export default App;

comments.js src/api/comments.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const comments = [
1+
const comments = [
22
{
33
"postId": 1,
44
"id": 1,
@@ -3499,4 +3499,6 @@ export const comments = [
34993499
"email": "[email protected]",
35003500
"body": "perspiciatis quis doloremque\nveniam nisi eos velit sed\nid totam inventore voluptatem laborum et eveniet\naut aut aut maxime quia temporibus ut omnis"
35013501
}
3502-
];
3502+
];
3503+
3504+
export default comments;

posts.js src/api/posts.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const posts = [
1+
const posts = [
22
{
33
"userId": 1,
44
"id": 1,
@@ -599,4 +599,6 @@ export const posts = [
599599
"title": "at nam consequatur ea labore ea harum",
600600
"body": "cupiditate quo est a modi nesciunt soluta\nipsa voluptas error itaque dicta in\nautem qui minus magnam et distinctio eum\naccusamus ratione error aut"
601601
}
602-
];
602+
];
603+
604+
export default posts;

users.js src/api/users.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const users = [
1+
const users = [
22
{
33
"id": 1,
44
"name": "Leanne Graham",
@@ -229,4 +229,6 @@ export const users = [
229229
"bs": "target end-to-end models"
230230
}
231231
}
232-
];
232+
];
233+
234+
export default users;

src/index.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
4+
import App from './App';
5+
6+
ReactDOM.render(<App />, document.getElementById('root'));

0 commit comments

Comments
 (0)