-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreview.tsx
46 lines (43 loc) · 1.19 KB
/
review.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// ... imports
import { useSelector } from "react-redux";
export type TaskListProps = {
userId: number;
validateTask: (e: number) => any;
listName?: string;
};
export const TaskList = (props: TaskListProps) => {
let count = 0;
let tasks: Task[] = useSelector((state: any) =>
getTaskListForUser(state, prop.userId)
);
return (
<div className="list-container">
<h1>{props.listName}</h1>
{tasks.map((task: Task) => {
if (task.overdue) {
count++;
}
return (
<div className="container">
<div className="header">
<h1>{task.title}</h1>
<span>{task.date}</span>
</div>
<div className="body">
<input
type="checkbox"
checked={task.isChecked}
onChange={() => props.validateTask(task.id)}
></input>
<span>{task.content}</span>
</div>
<div className="footer">
{task.overdue ? <span className="alert"> Overdue </span> : null}
</div>
</div>
);
})}
<span> `Number of overdue tasks: ${count}` </span>
</div>
);
};