Components Overview
Tienda ETCA uses a component-based architecture built with React. Components are organized into two main directories: reusable UI components and layout containers.Component Categories
UI Components
Reusable building blocks for the application
Layout Components
Page-level containers and structural components
UI Components
Located in~/workspace/source/src/components/, these components provide reusable functionality across the application.
Navigation & Structure
Header
Header
Main navigation header with logo, menu links, shopping cart, and login/admin access.Location:
src/components/Header.jsxFeatures:- Navigation menu (Inicio, Nosotros, Galería, Contacto)
- Shopping cart button with item count
- Login and Admin access buttons
- Integrates with CartContext for cart state
Footer
Footer
Content Display
Main
Main
Hero section component with text content on the left and image on the right.Location:
src/components/Main.jsxProps:titular(string) - Section headingtexto(string) - Description textboton(string) - Button labelimagen(string) - Image URL
Main2
Main2
Hero section component with image on the left and text content on the right.Location:
src/components/Main2.jsxProps:titular(string) - Section headingtexto(string) - Description textboton(string) - Button labelimagen(string) - Image URL
Product Components
Product
Product
Individual product card component displaying product information.Location:
src/components/Product.jsxProps:product(object) - Product data containing:id- Product identifiernombre- Product nameprecio- Product pricestock- Available stockimagen- Product image URL
- Product image display
- Name, price, and stock information
- “Add to cart” button
- “View details” link
- Integrates with CartContext
ProductList
ProductList
Product gallery with search, pagination, and filtering.Location:
src/components/ProductList.jsxFeatures:- Search input for filtering products
- Paginated product display (5 items per page)
- Bootstrap pagination controls
- Smooth scroll to top on page change
- Integrates with CartContext for product data
- Uses CartContext for
productosFiltradosandbusqueda - Local state for pagination
Cart
Cart
Shopping cart drawer with purchase management.Location:
src/components/Cart.jsxFeatures:- Slide-out cart drawer
- Product quantity controls (+/-)
- Individual item removal
- Empty cart button
- Total price calculation
- Purchase confirmation with SweetAlert2
- Integrates with CartContext
- Increase/decrease quantity
- Remove items
- Clear cart
- Finalize purchase
Form Components
See the dedicated Forms Documentation for detailed information about form components.Formulario
Contact form component
FormularioProducto
Add new product form
FormularioEdicion
Edit existing product form
Other Components
Equipo
Equipo
Team member display component showing staff profiles.Location:
src/components/Equipo.jsxProps:equipo(array) - Array of team member objects containing:nombre- Member namerol- Member role/positionimagen- Profile photo URL
ListaUsuarios
ListaUsuarios
Demo component that fetches and displays users from an API.Location:
src/components/ListaUsuarios.jsxFeatures:- Fetches data from JSONPlaceholder API
- Loading state management
- Error handling
- Displays user name and website
https://jsonplaceholder.typicode.com/usersNotFound
NotFound
404 error page component.Location:
src/components/NotFound.jsxFeatures:- Custom 404 error message
- “Go back” button using React Router navigation
- Friendly error messaging in Spanish
Layout Components
Located in~/workspace/source/src/layout/, these components compose full page layouts.
Home
Main landing page layout
GaleriaProductos
Product gallery page layout
Admin
Administrative dashboard layout
DetallesProductos
Product details page layout
AcercaDe
About us page layout
Contacto
Contact page layout
Login
Login page layout
Home Layout
Location:src/layout/Home.jsx
Composed Components:
- Header
- Main (hero section)
- ProductList
- Cart
- Main2 (secondary content)
- Footer
- Loading state with animated GIF
- Error handling with NotFound component
- Uses CartContext for loading and error states
Galeria Layout
Location:src/layout/GaleriaProductos.jsx
Composed Components:
- Header
- ProductList
- Cart
- Footer
- Dedicated product browsing page
- Loading state management
- Full product catalog display
Admin Layout
Location:src/layout/Admin.jsx
Composed Components:
- FormularioProducto (conditional)
- FormularioEdicion (conditional)
- Product management dashboard
- Add, edit, and delete products
- Custom admin navigation
- Logout functionality
- Uses AdminContext for product operations
- Modal-based forms for product management
The Admin layout requires authentication. It integrates with AuthContext to manage user authentication state.
Context Integration
Many components integrate with React Context for state management:File Structure
Next Steps
Layout Components
Detailed documentation for Header, Footer, and Main components
Form Components
Complete guide to form components and validation