Skip to content

Commit 0a00951

Browse files
committed
Set cursor: pointer to SelectColors
1 parent 3d72bd8 commit 0a00951

File tree

21 files changed

+10772
-1
lines changed

21 files changed

+10772
-1
lines changed

15/context-tutorial/src/components/SelectColors.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ class SelectColors extends Component {
2222
{colors.map(color => (
2323
<div
2424
key={color}
25-
style={{ background: color, width: '24px', height: '24px' }}
25+
style={{
26+
background: color,
27+
width: '24px',
28+
height: '24px',
29+
cursor: 'pointer'
30+
}}
2631
onClick={() => this.handleSetColor(color)}
2732
onContextMenu={e => {
2833
e.preventDefault();

17/README.md

Lines changed: 68 additions & 0 deletions
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+
### `npm 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+
### `npm 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+
### `npm run 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+
### `npm run 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+
### `npm run 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

17/package.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "react-redux-tutorial",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"immer": "^2.1.0",
7+
"react": "^16.8.3",
8+
"react-dom": "^16.8.3",
9+
"react-redux": "^5.0.7",
10+
"react-scripts": "2.1.5",
11+
"redux": "^4.0.1",
12+
"redux-actions": "^2.6.4",
13+
"redux-devtools-extension": "^2.13.8"
14+
},
15+
"scripts": {
16+
"start": "react-scripts start",
17+
"build": "react-scripts build",
18+
"test": "react-scripts test",
19+
"eject": "react-scripts eject"
20+
},
21+
"eslintConfig": {
22+
"extends": "react-app"
23+
},
24+
"browserslist": [
25+
">0.2%",
26+
"not dead",
27+
"not ie <= 11",
28+
"not op_mini all"
29+
]
30+
}

17/public/favicon.ico

3.78 KB
Binary file not shown.

17/public/index.html

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

17/public/manifest.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

17/src/App.css

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.App {
2+
text-align: center;
3+
}
4+
5+
.App-logo {
6+
animation: App-logo-spin infinite 20s linear;
7+
height: 40vmin;
8+
pointer-events: none;
9+
}
10+
11+
.App-header {
12+
background-color: #282c34;
13+
min-height: 100vh;
14+
display: flex;
15+
flex-direction: column;
16+
align-items: center;
17+
justify-content: center;
18+
font-size: calc(10px + 2vmin);
19+
color: white;
20+
}
21+
22+
.App-link {
23+
color: #61dafb;
24+
}
25+
26+
@keyframes App-logo-spin {
27+
from {
28+
transform: rotate(0deg);
29+
}
30+
to {
31+
transform: rotate(360deg);
32+
}
33+
}

17/src/App.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
import CounterContainer from './containers/CounterContainer';
3+
import TodosContainer from './containers/TodosContainer';
4+
5+
const App = () => {
6+
return (
7+
<div>
8+
<CounterContainer />
9+
<hr />
10+
<TodosContainer />
11+
</div>
12+
);
13+
};
14+
15+
export default App;

17/src/App.test.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+
import App from './App';
4+
5+
it('renders without crashing', () => {
6+
const div = document.createElement('div');
7+
ReactDOM.render(<App />, div);
8+
ReactDOM.unmountComponentAtNode(div);
9+
});

17/src/components/Counter.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
3+
const Counter = React.memo(({ number, onIncrease, onDecrease }) => {
4+
return (
5+
<div>
6+
<h1>{number}</h1>
7+
<div>
8+
<button onClick={onIncrease}>+1</button>
9+
<button onClick={onDecrease}>-1</button>
10+
</div>
11+
</div>
12+
);
13+
});
14+
15+
export default Counter;

17/src/components/Todos.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React from 'react';
2+
3+
const TodoItem = ({ todo, onToggle, onRemove }) => {
4+
return (
5+
<div>
6+
<input
7+
type="checkbox"
8+
onClick={() => onToggle(todo.id)}
9+
checked={todo.done}
10+
readOnly={true}
11+
/>
12+
<span style={{ textDecoration: todo.done ? 'line-through' : 'none' }}>
13+
{todo.text}
14+
</span>
15+
<button onClick={() => onRemove(todo.id)}>삭제</button>
16+
</div>
17+
);
18+
};
19+
20+
const Todos = ({
21+
input, // 인풋에 입력되는 텍스트
22+
todos, // 할 일 목록이 들어있는 객체
23+
onChangeInput,
24+
onInsert,
25+
onToggle,
26+
onRemove,
27+
}) => {
28+
const onSubmit = e => {
29+
e.preventDefault();
30+
onInsert(input);
31+
onChangeInput(''); // 등록 후 인풋 초기화
32+
};
33+
const onChange = e => onChangeInput(e.target.value);
34+
return (
35+
<div>
36+
<form onSubmit={onSubmit}>
37+
<input value={input} onChange={onChange} />
38+
<button type="submit">등록</button>
39+
</form>
40+
<div>
41+
{todos.map(todo => (
42+
<TodoItem
43+
todo={todo}
44+
key={todo.id}
45+
onToggle={onToggle}
46+
onRemove={onRemove}
47+
/>
48+
))}
49+
</div>
50+
</div>
51+
);
52+
};
53+
54+
export default Todos;

17/src/containers/CounterContainer.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React, { useCallback } from 'react';
2+
import { connect } from 'react-redux';
3+
import Counter from '../components/Counter';
4+
import { increase, decrease } from '../modules/counter';
5+
6+
const CounterContainer = ({ number, increase, decrease }) => {
7+
return (
8+
<Counter number={number} onIncrease={increase} onDecrease={decrease} />
9+
);
10+
};
11+
12+
export default connect(
13+
state => ({
14+
number: state.counter.number,
15+
}),
16+
{
17+
increase,
18+
decrease,
19+
},
20+
)(CounterContainer);

17/src/containers/TodosContainer.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React from 'react';
2+
import { connect } from 'react-redux';
3+
import { changeInput, insert, toggle, remove } from '../modules/todos';
4+
import Todos from '../components/Todos';
5+
6+
const TodosContainer = ({
7+
input,
8+
todos,
9+
changeInput,
10+
insert,
11+
toggle,
12+
remove,
13+
}) => {
14+
return (
15+
<Todos
16+
input={input}
17+
todos={todos}
18+
onChangeInput={changeInput}
19+
onInsert={insert}
20+
onToggle={toggle}
21+
onRemove={remove}
22+
/>
23+
);
24+
};
25+
26+
export default connect(
27+
// 비구조화 할당을 통하여 todos 를 분리하여
28+
// state.todos.input 대신 todos.input 을 사용
29+
({ todos }) => ({
30+
input: todos.input,
31+
todos: todos.todos,
32+
}),
33+
{
34+
changeInput,
35+
insert,
36+
toggle,
37+
remove,
38+
},
39+
)(TodosContainer);

17/src/index.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
body {
2+
margin: 0;
3+
padding: 0;
4+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
5+
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
6+
sans-serif;
7+
-webkit-font-smoothing: antialiased;
8+
-moz-osx-font-smoothing: grayscale;
9+
}
10+
11+
code {
12+
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
13+
monospace;
14+
}

17/src/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import { createStore } from 'redux';
4+
import { Provider } from 'react-redux';
5+
import { composeWithDevTools } from 'redux-devtools-extension';
6+
import './index.css';
7+
import App from './App';
8+
import * as serviceWorker from './serviceWorker';
9+
import rootReducer from './modules';
10+
11+
const store = createStore(rootReducer, composeWithDevTools());
12+
13+
ReactDOM.render(
14+
<Provider store={store}>
15+
<App />
16+
</Provider>,
17+
document.getElementById('root'),
18+
);
19+
20+
serviceWorker.unregister();

0 commit comments

Comments
 (0)