mirror of
https://github.com/tiennm99/ai-coding-workflow-labs.git
synced 2026-09-17 04:18:33 +00:00
- Subscribes to store.items signal - Displays each item with name and formatted price - Includes ItemAssign component for each item - Shows empty state when no items added
26 lines
714 B
React
26 lines
714 B
React
import { store } from '../../store/billStore.js';
|
|
import { formatCurrency } from '../../utils/currency.js';
|
|
import { ItemAssign } from './ItemAssign.jsx';
|
|
|
|
export function ItemsList() {
|
|
const items = store.items.value;
|
|
|
|
if (items.length === 0) {
|
|
return <p class="empty-state">No items added yet</p>;
|
|
}
|
|
|
|
return (
|
|
<ul class="items-list">
|
|
{items.map((item) => (
|
|
<li key={item.id} class="item-row">
|
|
<div class="item-header">
|
|
<span class="item-name">{item.name}</span>
|
|
<span class="item-price">{formatCurrency(item.priceCents)}</span>
|
|
</div>
|
|
<ItemAssign item={item} />
|
|
</li>
|
|
))}
|
|
</ul>
|
|
);
|
|
}
|