File tree Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Expand file tree Collapse file tree 4 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ const Item: React.FC<Props> = ({ todo }) => {
62
62
// search clicked item by id...
63
63
if ( t . id === id ) {
64
64
// change complated status only clicked item
65
- return { ...t , completed : ! t . completed }
65
+ return { ...t , completed : ! t . completed , inProgress : false }
66
66
// return other item without any changes
67
67
} else {
68
68
return t
@@ -140,7 +140,15 @@ const Item: React.FC<Props> = ({ todo }) => {
140
140
className = "inProgressBadeg"
141
141
onClick = { ( ) => setInprogress ( todo . id ) }
142
142
>
143
- In Progress
143
+ Backlog
144
+ </ span >
145
+ ) }
146
+ { todo . completed && ! todo . inProgress && (
147
+ < span
148
+ className = "completedBadeg"
149
+ onClick = { ( ) => setInprogress ( todo . id ) }
150
+ >
151
+ Completed
144
152
</ span >
145
153
) }
146
154
{ /* eslint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/click-events-have-key-events */ }
Original file line number Diff line number Diff line change @@ -139,4 +139,15 @@ export const Layout = styled.div`
139
139
margin-right: 70px;
140
140
cursor: pointer;
141
141
}
142
+
143
+ .completedBadeg {
144
+ padding: 3px 5px;
145
+ border-radius: 3px;
146
+ font-size: 0.5em;
147
+ background-color: #2ecc71;
148
+ color: white;
149
+ font-weight: 600;
150
+ margin-right: 70px;
151
+ cursor: pointer;
152
+ }
142
153
`
Original file line number Diff line number Diff line change @@ -46,7 +46,9 @@ const TodoList: React.FC = () => {
46
46
case '/' :
47
47
return true
48
48
case '/backlog' :
49
- return t . completed === false
49
+ return t . completed === false && t . inProgress === false
50
+ case '/in-progress' :
51
+ return t . inProgress === true
50
52
case '/completed' :
51
53
return t . completed === true
52
54
default :
Original file line number Diff line number Diff line change @@ -9,8 +9,12 @@ import { Layout } from './style'
9
9
10
10
const UnderBar : React . FC = ( ) => {
11
11
const [ appState , setAppState ] = useRecoilState < AppState > ( recoilState )
12
- const completed : number = appState . todoList . filter ( t => t . completed === true ) . length /* eslint-disable-line prettier/prettier */
13
- const backlog : number = appState . todoList . filter ( t => t . completed === false ) . length /* eslint-disable-line prettier/prettier */
12
+ const completed : number = appState . todoList . filter (
13
+ ( t ) => t . completed
14
+ ) . length /* eslint-disable-line prettier/prettier */
15
+ const backlog : number = appState . todoList . filter (
16
+ ( t ) => t . completed === false
17
+ ) . length /* eslint-disable-line prettier/prettier */
14
18
15
19
function clearCompleted ( ) : void {
16
20
setAppState ( {
You can’t perform that action at this time.
0 commit comments