Skip to content

Commit 30623d1

Browse files
committed
day-13 update CRA and code
1 parent 580eac4 commit 30623d1

27 files changed

+8918
-5865
lines changed

day-13/README.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `yarn start`
8+
9+
Runs the app in the development mode.<br />
10+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
11+
12+
The page will reload if you make edits.<br />
13+
You will also see any lint errors in the console.
14+
15+
### `yarn test`
16+
17+
Launches the test runner in the interactive watch mode.<br />
18+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
20+
### `yarn build`
21+
22+
Builds the app for production to the `build` folder.<br />
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
The build is minified and the filenames include the hashes.<br />
26+
Your app is ready to be deployed!
27+
28+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29+
30+
### `yarn eject`
31+
32+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33+
34+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35+
36+
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37+
38+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39+
40+
## Learn More
41+
42+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43+
44+
To learn React, check out the [React documentation](https://reactjs.org/).
45+
46+
### Code Splitting
47+
48+
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
49+
50+
### Analyzing the Bundle Size
51+
52+
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
53+
54+
### Making a Progressive Web App
55+
56+
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
57+
58+
### Advanced Configuration
59+
60+
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
61+
62+
### Deployment
63+
64+
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
65+
66+
### `yarn build` fails to minify
67+
68+
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

day-13/package.json

+25-46
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,34 @@
11
{
2-
"name": "30Days",
2+
"name": "day-13",
33
"version": "0.1.0",
44
"private": true,
5-
"devDependencies": {
6-
"@fullstackio/cqmd": "^5.0.6",
7-
"babel-jest": "^19.0.0",
8-
"babel-polyfill": "^6.23.0",
9-
"babel-preset-stage-0": "^6.22.0",
10-
"enzyme": "^2.8.0",
11-
"git-rev": "^0.2.1",
12-
"gray-matter": "^2.1.1",
13-
"highlight.js": "^9.10.0",
14-
"hljs": "^6.2.3",
15-
"jest-cli": "^19.0.2",
16-
"map-stream": "^0.0.7",
17-
"marked": "^0.3.6",
18-
"nodemon": "^1.11.0",
19-
"npm-run-all": "^4.0.2",
20-
"nunjucks": "^3.0.0",
21-
"react-addons-test-utils": "^15.4.2",
22-
"react-scripts": "0.9.5",
23-
"react-test-renderer": "^15.4.2",
24-
"redux-mock-store": "^1.2.2",
25-
"simple-git": "^1.69.0",
26-
"sinon": "^2.1.0",
27-
"vinyl-fs": "^2.4.4"
28-
},
295
"dependencies": {
30-
"autoprefixer": "^6.7.7",
31-
"font-awesome": "^4.7.0",
32-
"moment": "^2.18.1",
33-
"postcss-cli": "^3.0.0",
34-
"postcss-import": "^9.1.0",
35-
"precss": "^1.4.0",
36-
"react": "^15.4.2",
37-
"react-dom": "^15.4.2",
38-
"react-frame-component": "^1.0.2",
39-
"react-redux": "^5.0.3",
40-
"react-router-dom": "^4.0.0",
41-
"redux": "^3.6.0"
6+
"@testing-library/jest-dom": "^4.2.4",
7+
"@testing-library/react": "^9.3.2",
8+
"@testing-library/user-event": "^7.1.2",
9+
"react": "^16.12.0",
10+
"react-dom": "^16.12.0",
11+
"react-scripts": "3.3.0"
4212
},
4313
"scripts": {
44-
"start": "npm-run-all -c --parallel start:*",
45-
"build": "npm-run-all build:*",
46-
"start:styles": "npm run build:styles -- --watch",
47-
"build:styles": "./node_modules/.bin/postcss --config postcss.config.js src/styles/index.css -o src/index.css",
48-
"start:react": "react-scripts start",
49-
"build:react": "react-scripts build",
50-
"start:render": "nodemon -w doc.md --exec 'npm run build:render'",
51-
"build:render": "node ./scripts/cqmd.js",
52-
"test": "react-scripts test --env=jsdom",
14+
"start": "react-scripts start",
15+
"build": "react-scripts build",
16+
"test": "react-scripts test",
5317
"eject": "react-scripts eject"
18+
},
19+
"eslintConfig": {
20+
"extends": "react-app"
21+
},
22+
"browserslist": {
23+
"production": [
24+
">0.2%",
25+
"not dead",
26+
"not op_mini all"
27+
],
28+
"development": [
29+
"last 1 chrome version",
30+
"last 1 firefox version",
31+
"last 1 safari version"
32+
]
5433
}
5534
}

day-13/postcss.config.js

-9
This file was deleted.

day-13/public/favicon.ico

-20.5 KB
Binary file not shown.

day-13/public/index.html

+38-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
1-
<!doctype html>
1+
<!DOCTYPE html>
22
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<meta
9+
name="description"
10+
content="Web site created using create-react-app"
11+
/>
12+
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13+
<!--
14+
manifest.json provides metadata used when your web app is installed on a
15+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16+
-->
17+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18+
<!--
19+
Notice the use of %PUBLIC_URL% in the tags above.
20+
It will be replaced with the URL of the `public` folder during the build.
21+
Only files inside the `public` folder can be referenced from the HTML.
322
4-
<head>
5-
<meta charset="utf-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
8-
<title>React App</title>
9-
</head>
23+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24+
work correctly both with client-side routing and a non-root public URL.
25+
Learn how to configure a non-root public URL by running `npm run build`.
26+
-->
27+
<title>React App</title>
28+
</head>
29+
<body>
30+
<noscript>You need to enable JavaScript to run this app.</noscript>
31+
<div id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
1035
11-
<body>
12-
<div class="demo">
13-
<div id="demo1"></div>
14-
<div id="demo2"></div>
15-
</div>
16-
17-
</body>
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
1838
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
</body>
1943
</html>

day-13/public/logo192.png

5.22 KB
Loading

day-13/public/logo512.png

9.44 KB
Loading

day-13/public/manifest.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
},
10+
{
11+
"src": "logo192.png",
12+
"type": "image/png",
13+
"sizes": "192x192"
14+
},
15+
{
16+
"src": "logo512.png",
17+
"type": "image/png",
18+
"sizes": "512x512"
19+
}
20+
],
21+
"start_url": ".",
22+
"display": "standalone",
23+
"theme_color": "#000000",
24+
"background_color": "#ffffff"
25+
}

day-13/public/robots.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *

day-13/src/App.css

+23-9
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,36 @@
33
}
44

55
.App-logo {
6-
animation: App-logo-spin infinite 20s linear;
7-
height: 80px;
6+
height: 40vmin;
7+
pointer-events: none;
8+
}
9+
10+
@media (prefers-reduced-motion: no-preference) {
11+
.App-logo {
12+
animation: App-logo-spin infinite 20s linear;
13+
}
814
}
915

1016
.App-header {
11-
background-color: #222;
12-
height: 150px;
13-
padding: 20px;
17+
background-color: #282c34;
18+
min-height: 100vh;
19+
display: flex;
20+
flex-direction: column;
21+
align-items: center;
22+
justify-content: center;
23+
font-size: calc(10px + 2vmin);
1424
color: white;
1525
}
1626

17-
.App-intro {
18-
font-size: large;
27+
.App-link {
28+
color: #61dafb;
1929
}
2030

2131
@keyframes App-logo-spin {
22-
from { transform: rotate(0deg); }
23-
to { transform: rotate(360deg); }
32+
from {
33+
transform: rotate(0deg);
34+
}
35+
to {
36+
transform: rotate(360deg);
37+
}
2438
}

day-13/src/App.js

+11-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
import React, { Component } from 'react';
2-
import logo from './logo.svg';
3-
import './App.css';
1+
import React from "react";
42

5-
class App extends Component {
6-
render() {
7-
return (
8-
<div className="App">
9-
<div className="App-header">
10-
<img src={logo} className="App-logo" alt="logo" />
11-
<h2>Welcome to React</h2>
12-
</div>
13-
<p className="App-intro">
14-
To get started, edit <code>src/App.js</code> and save to reload.
15-
</p>
16-
</div>
17-
);
18-
}
19-
}
3+
const a = [1, 10, 100, 1000, 10000];
4+
const App = props => {
5+
return (
6+
<ul>
7+
{React.Children.map(a, i => (
8+
<li>{i}</li>
9+
))}
10+
</ul>
11+
);
12+
};
2013

2114
export default App;

day-13/src/App.test.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
2+
import { render } from '@testing-library/react';
33
import App from './App';
44

5-
it('renders without crashing', () => {
6-
const div = document.createElement('div');
7-
ReactDOM.render(<App />, div);
5+
test('renders learn react link', () => {
6+
const { getByText } = render(<App />);
7+
const linkElement = getByText(/learn react/i);
8+
expect(linkElement).toBeInTheDocument();
89
});

day-13/src/ChildMap.js

-11
This file was deleted.

day-13/src/Repeater.js

-14
This file was deleted.

day-13/src/RepeaterKey.js

-14
This file was deleted.

0 commit comments

Comments
 (0)