costco-grocery-list/frontend/src/components/GroceryItem.tsx
2025-11-15 21:59:43 -10:00

24 lines
506 B
TypeScript
Executable File

import type { GroceryItemType } from "../types";
interface Props {
item: GroceryItemType;
onClick: (id: number) => void;
}
export default function GroceryItem({ item, onClick }: Props) {
return (
<li
onClick={() => onClick(item.id)}
style={{
padding: "0.5em",
background: "#e9ecef",
marginBottom: "0.5em",
borderRadius: "4px",
cursor: "pointer",
}}
>
{item.item_name} ({item.quantity})
</li>
);
}