Skip to content

Commit

Permalink
feat(#12): Moved the location of delete button
Browse files Browse the repository at this point in the history
  • Loading branch information
shuveksha-tuladhar committed Sep 21, 2024
1 parent 55e8bc8 commit 2213d76
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/components/ListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ export function ListItem({
}
}
};



// handleDelete Function
const handleDelete = async () => {
const deleteConfirm = window.confirm(
const deleteConfirm = window.confirm(
`Are you sure you want to delete ${name}?`,
);

Expand All @@ -84,11 +83,7 @@ export function ListItem({
return (
<>
<tr className="ListItem">
<td>{name}
<button onClick={handleDelete} aria-label={`Delete ${name}`}>
Delete
</button>
</td>
<td>{name}</td>

<td>
<Toggle
Expand All @@ -102,9 +97,11 @@ export function ListItem({
<td>
{dateLastPurchased ? dateLastPurchased.toDate().toLocaleString() : ''}
</td>
<td className={urgencyClass}>{sortCriteria.tag}</td>
<td className={urgencyClass}>{sortCriteria.tag} </td>
<button onClick={handleDelete} aria-label={`Delete ${name}`}>
Delete
</button>
</tr>

</>
);
}

0 comments on commit 2213d76

Please sign in to comment.