Files
superlist/apps/web/src/components/items/bought-item-list.tsx
Jose Selesan 812d4b7170 feat(web): green, warm-paper theme with a matching dark mode
- New light palette (warm off-white background, white cards, grocery green
  primary) and a green-tinted charcoal dark mode; larger radius.
- Items render as one grouped card; bought items live in a collapsible
  "Comprados · N" card with a muted header.
- Pill-shaped add-item input (shadcn input-group) with a round add button.
- Progress summary ("N pendientes · M comprados" + bar) above the input.
- Active bottom-nav item uses the primary color with a dot.
- theme-color metas and PWA manifest follow the new background.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 14:55:48 -03:00

45 lines
1.6 KiB
TypeScript

import type { ListItem } from '@superlist/shared'
import { ChevronDownIcon } from 'lucide-react'
import { Card } from '@/components/ui/card'
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'
import type { useUpdateItem } from '@/hooks/use-items'
import { ItemRow } from './item-row'
type BoughtItemListProps = {
items: ListItem[]
updateItem: ReturnType<typeof useUpdateItem>
savingIds: string[]
}
/**
* Collapsible "Comprados" card below the pending items. Expanded by default so
* marking an item visibly moves it down; the user can fold it. Tapping an item
* here un-buys it and it returns to the pending list.
*/
export function BoughtItemList({ items, updateItem, savingIds }: BoughtItemListProps) {
return (
<Collapsible defaultOpen asChild>
<Card className="gap-0 py-0">
<CollapsibleTrigger className="group bg-muted text-muted-foreground hover:text-foreground flex w-full items-center gap-3 px-4 py-3 text-left transition-colors">
<ChevronDownIcon className="size-5 transition-transform group-data-[state=closed]:-rotate-90" />
<span className="text-base">Comprados · {items.length}</span>
</CollapsibleTrigger>
<CollapsibleContent>
<ul className="divide-y">
{items.map((item) => (
<ItemRow
key={item.id}
item={item}
updateItem={updateItem}
isSaving={savingIds.includes(item.id)}
/>
))}
</ul>
</CollapsibleContent>
</Card>
</Collapsible>
)
}