Skip to content

Commit ec3392c

Browse files
committed
https://www.valentinog.com/blog/redux/
1 parent 0974685 commit ec3392c

Some content is hidden

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

68 files changed

+24195
-897
lines changed

chapter11-3-1/package-lock.json

Lines changed: 754 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chapter11-3-1/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6+
"node-sass": "^4.12.0",
67
"react": "^16.8.6",
78
"react-dom": "^16.8.6",
9+
"react-icons": "^3.7.0",
810
"react-redux": "^7.0.3",
911
"react-router": "^5.0.0",
1012
"react-router-dom": "^5.0.0",

chapter11-3-1/src/AddColorForm.js

Lines changed: 0 additions & 44 deletions
This file was deleted.

chapter11-3-1/src/App.js

Lines changed: 0 additions & 39 deletions
This file was deleted.

chapter11-3-1/src/Color.css

Lines changed: 0 additions & 18 deletions
This file was deleted.

chapter11-3-1/src/Color.js

Lines changed: 0 additions & 94 deletions
This file was deleted.

chapter11-3-1/src/Star.css

Lines changed: 0 additions & 24 deletions
This file was deleted.

chapter11-3-1/src/Star.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

chapter11-3-1/src/StarRating.js

Lines changed: 0 additions & 40 deletions
This file was deleted.

chapter11-3-1/src/actions.js

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,24 @@
11
import C from './constants'
2+
import { v4 } from 'uuid'
3+
4+
export const addColor = (title, color) =>
5+
({
6+
type: C.ADD_COLOR,
7+
id: v4(),
8+
title,
9+
color,
10+
timestamp: new Date().toString()
11+
})
212

313
export const removeColor = id =>
4-
({
5-
type : C.REMOVE_COLOR,
6-
id
7-
})
14+
({
15+
type: C.REMOVE_COLOR,
16+
id
17+
})
818

919
export const rateColor = (id, rating) =>
10-
({
11-
type : C.RATE_COLOR,
12-
id,
13-
rating
14-
})
15-
16-
export const sortColors = sortedBy =>
17-
(sortedBy === 'rating') ? ({
18-
type:C.SORT_COLORS,
19-
sortedBy : 'SORTED_BY_RATING'
20-
}) :
21-
(sortedBy === 'title') ? ({
22-
type : C.SORT_COLORS,
23-
sortBy : 'SORTED_BY_TITLE'
24-
}) : ({
25-
type : C.SORT_COLORS,
26-
sortBy : 'SORTED_BY_DATE'
27-
});
28-
29-
export const addColor = (title, color) => ({
30-
type : C.ADD_COLOR,
31-
id : Math.random()*458723233,
32-
title,
33-
color,
34-
timestamp : new Date().toString()
35-
})
36-
37-
//store.dispatch(addColor('잔디', '#998f12')); 캡슐화 + 디버깅 용이
20+
({
21+
type: C.RATE_COLOR,
22+
id,
23+
rating
24+
})

0 commit comments

Comments
 (0)