A small SPA to manage a shopping list.
This project demonstrates modern React with TypeScript, clean structure, and clear code comments in English.
https://react-shopping-list-mgomez.vercel.app
- 🧠 Global state with Context + Reducer (typed actions & state)
- ➕ Add items, ✏️ inline edit (name & quantity), ✅ toggle purchased, 🗑️ delete
- 🧹 Clear purchased and Clear all
- 🔎 Filter pills (All / Pending / Purchased) with live counters
- 💾 LocalStorage persistence (per domain)
- 🎨 Tailwind CSS v4 styles (via
@tailwindcss/postcss
) - ♿ Accessible basics (labels, focus states, keyboard Enter/Escape on edit)
- 🚀 Deployed on Vercel (CI on push to
main
)
- React 18 + TypeScript
- Vite
- Tailwind CSS v4
- (Deployment) Vercel
npm install
npm run dev
# open http://localhost:5173
npm run build
npm run preview
# open http://localhost:4173
react-shopping-list/
├─ src/
│ ├─ components/
│ │ ├─ FilterBar.tsx
│ │ ├─ FilterBarContainer.tsx
│ │ ├─ ItemForm.tsx
│ │ ├─ ItemList.tsx
│ │ └─ ItemRow.tsx
│ ├─ context/
│ │ ├─ ShoppingContext.tsx # Provider + hook + localStorage sync
│ │ └─ shoppingReducer.ts # Reducer, actions, initialState
│ ├─ domain/
│ │ ├─ models.ts # Item types
│ │ └─ filters.ts # StatusFilter types
│ ├─ App.tsx
│ ├─ main.tsx
│ └─ index.css # Tailwind entry (@import "tailwindcss")
├─ public/ # (Vite: it’s empty or with a favicon)
├─ postcss.config.cjs
├─ tailwind.config.cjs
├─ tsconfig.json
├─ vite.config.ts
└─ README.md
- State management: Context + Reducer (pure functions, predictable updates).
- Persistence:
localStorage
under the keyshopping_state
. - UI state vs. app state: the current filter is UI state (component), items are global (context).
- Tailwind v4: configured with
postcss.config.cjs
andtailwind.config.cjs
; CSS entry uses@import "tailwindcss"
.
- ✅ Unit tests with Vitest + React Testing Library
- Sorting & simple categories/priorities
- Basic empty states and micro-animations
- ESLint + Prettier config
This project is licensed under the MIT License. See LICENSE
for details.