Skip to content

Commit

Permalink
TodoItem Component
Browse files Browse the repository at this point in the history
  • Loading branch information
EuJinnLucaShow committed Nov 25, 2023
1 parent ae43599 commit dfa3b59
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "avoid",
"proseWrap": "always"
}
3 changes: 0 additions & 3 deletions src/components/InputForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ const InputForm = () => {
onChange={''}
required
/>



<button type="submit">Add</button>
</form>
);
Expand Down
24 changes: 24 additions & 0 deletions src/components/TodoItem.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

const TodoItem = ({ todo, onDelete, onEdit }) => {
const { id, title, completed } = todo;

const handleDelete = () => {
onDelete(id);
};

const handleEdit = () => {
onEdit(id);
};

return (
<div className="todo-item">
<input type="checkbox" checked={completed} onChange={() => {}} />
<p className={completed ? 'completed' : ''}>{title}</p>
<button onClick={handleEdit}>Edit</button>
<button onClick={handleDelete}>Delete</button>
</div>
);
};

export default TodoItem;

0 comments on commit dfa3b59

Please sign in to comment.