How jeffersonribeiro/react-shopping-cart works
This is a React/TypeScript shopping-cart storefront. The user workflow is to view products, filter by available size, add or remove items in a floating cart, and see quantity and price totals update. Product loading/filtering and cart state are distinct domain stages; shared styled-components and theme provide an internal presentation layer. The README documents the core capabilities, while sampled source confirms the app composition and context hooks. Some component-to-context links are documented only at a high level, so those edges cite the README.
Main entry points: App.tsx App composition · Cart.tsx Floating cart · useProducts.tsx Product workflow · useCartProducts.ts Cart operations
Components 22
Storefront
- App composition
src/components/App/App.tsx - Loading indicator
src/components/Loader/Loader.tsx - GitHub links
src/components/Github - Recruiter panel
src/components/Recruiter/Recruiter.tsx
Product catalog
- Product listing
src/components/Products/Products.tsx - Product card
src/components/Products/Product/Product.tsx - Size filter
src/components/Filter/Filter.tsx - Product workflow
src/contexts/products-context/useProducts.tsx - Product state
src/contexts/products-context/ProductsContextProvider.tsx - Product service
src/services/products.ts
Cart state
- Floating cart
src/components/Cart/Cart.tsx - Cart item list
src/components/Cart/CartProducts/CartProducts.tsx - Cart item
src/components/Cart/CartProducts/CartProduct/CartProduct.tsx - Cart operations
src/contexts/cart-context/useCartProducts.ts - Cart totals
src/contexts/cart-context/useCartTotal.ts - Cart state
src/contexts/cart-context/CartContextProvider.tsx
Presentation
- Checkbox control
src/commons/Checkbox/Checkbox.tsx - Global styles
src/commons/style/global-style.tsx - Styled components
src/commons/style/styled-components.ts - Theme tokens
src/commons/style/theme.ts - Price formatting
src/utils/formatPrice.ts
Other components
- Shopper
Connections 24
- Shopper → App composition: uses storefront
- App composition → Product workflow: loads products
src/components/App/App.tsx - App composition → Loading indicator: shows loading
src/components/App/App.tsx - App composition → GitHub links: renders links
src/components/App/App.tsx - App composition → Recruiter panel: renders panel
src/components/App/App.tsx - App composition → Size filter: renders filter
src/components/App/App.tsx - App composition → Product listing: renders listing
src/components/App/App.tsx - App composition → Floating cart: renders cart
src/components/App/App.tsx - Product workflow → Product state: reads and updates
src/contexts/products-context/useProducts.tsx - Product workflow → Product service: fetches products
src/contexts/products-context/useProducts.tsx - Product listing → Product card: renders cards
src/components/Products/Products.tsx - Size filter → Checkbox control: uses control
- Size filter → Product workflow: filters by size
- Product card → Cart operations: adds products
- Floating cart → Cart operations: uses cart actions
- Floating cart → Cart item list: renders items
src/components/Cart/Cart.tsx - Cart item list → Cart item: renders rows
src/components/Cart/CartProducts/CartProducts.tsx - Cart operations → Cart state: reads and updates
src/contexts/cart-context/useCartProducts.ts - Cart operations → Cart totals: updates totals
src/contexts/cart-context/useCartProducts.ts - Cart totals → Cart state: stores total
src/contexts/cart-context/useCartTotal.ts - App composition → Global styles: applies styles
- Global styles → Styled components: uses styling API
src/commons/style/global-style.tsx - Styled components → Theme tokens: types theme
src/commons/style/styled-components.ts - Floating cart → Price formatting: formats prices