forked from rpailer/todo-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTodoList.jsx
32 lines (27 loc) · 1.21 KB
/
TodoList.jsx
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
import { Checkbox, ListItemSecondaryAction, ListItemText } from "@mui/material";
import DeleteOutlined from "@mui/icons-material/DeleteOutlined";
import { IconButton, List, ListItem, Paper } from "@mui/material";
export default function TodoList (props) {
const {todos, onDelete, onToggle} = props;
console.log(todos);
return (
<Paper>
<List>
{todos.list && todos.list.map((todo, idx) => {
return (
<ListItem key={todo._id} divider={idx !== todos.list.length - 1}>
<Checkbox checked={todo.finished} onClick={() => onToggle(todo._id)}/>
<ListItemText>{todo.text}</ListItemText>
<ListItemText>{todo.dueDate}</ListItemText>
<ListItemSecondaryAction>
<IconButton aria-label="Delete Todo" onClick={() => onDelete(todo._id)}>
<DeleteOutlined />
</IconButton>
</ListItemSecondaryAction>
</ListItem>
);
})}
</List>
</Paper>
);
}