Component Architecture
Q-Sopa is built with a modular component architecture using React. The application consists of five core components that work together to create a dynamic restaurant menu experience.Component Hierarchy
Import Patterns
All components follow a consistent import pattern:Available Components
Navbar
Top navigation bar with logo and category menu integration
Categories
Responsive category selector with desktop horizontal menu and mobile drawer
ProductCard
Reusable card component for displaying menu items with image, title, price, and badge
LogoSplash
Welcome screen with animated logo displayed when no category is selected
Footer
Simple footer with copyright information
Component Communication
The application uses callback props for parent-child communication:Categories component receives the callback and triggers it when a category is selected, updating the parent state and fetching new products.
Styling Approach
All components use CSS modules with BEM-inspired naming conventions:- Each component has its own
.cssfile - Class names use semantic naming (e.g.,
.product-card,.navbar-wrapper) - Responsive styles handle desktop and mobile layouts
- CSS custom properties are used for consistent theming
Data Flow
- Categories component fetches available categories from the API
- User selects a category
- Navbar passes the category ID up to the Menu page via
onCategoryChangecallback - Menu page fetches products for that category
- ProductCard components render the product data
- When no category is selected, LogoSplash is displayed
All components are functional components using React hooks (useState, useEffect) for state management and side effects.
