sf-92a / src /components /Todo.tsx
Passpass119's picture
Add 8 files
4ed92bb verified
raw
history blame contribute delete
658 Bytes
const Todo = ({ todo, createTodo }: { todo: Todo, createTodo: (title: string, deadline: string, status: string) => void }) => {
const handleClick = () => {
const titleInput = prompt('Enter a new title for the todo');
const deadlineInput = prompt('Enter a new deadline for the todo');
const statusInput = prompt('Enter a new status for the todo');
createTodo(titleInput ?? todo.title, deadlineInput ?? todo.deadline, statusInput ?? todo.status);
};
return (
<li>
<h2>{todo.title}</h2>
<p>{todo.deadline}</p>
<p>{todo.status}</p>
<button onClick={handleClick}>Edit</button>
</li>
);
};
export default Todo;