Overview
The Navbar component serves as the main navigation header for the Q-Sopa application. It displays the restaurant logo and integrates the Categories component for menu navigation.Location
Props
Callback function triggered when a category is selected. Receives the category ID as a parameter.
Although the code shows
onLogoClick being passed to Navbar in Menu.jsx, it’s not currently used in the Navbar component implementation. The logo link is a simple <a href="#"> tag.Source Code
src/components/navbar/Navbar.jsx
Usage Example
The Navbar is typically used at the page level with state management for category changes:src/pages/Menu.jsx
Structure
The Navbar has a simple three-part layout:1. Wrapper (navbar-wrapper)
The outer <header> element that provides the full-width container.
2. Logo Section (navbar-left)
Contains the Q-Sopa logo image wrapped in an anchor tag. The logo is imported from src/assets/logo_Q-spoa.jpg.
3. Categories Section (navbar-center)
Embeds the Categories component and passes down the onCategoryChange callback for category selection handling.
Styling Details
The Navbar uses CSS classes for layout:.navbar-wrapper- Main header container with fixed positioning.navbar- Flex container for layout.navbar-left- Left-aligned logo section.navbar-center- Center-aligned categories section.navbar-logo- Styles for the logo image
Component Relationships
The Navbar acts as a pass-through component, receiving theonCategoryChange callback from the parent Menu page and forwarding it to the Categories component.
Assets
The component imports and displays the restaurant logo:Best Practices
Callback Pattern
Always provide the
onCategoryChange callback to enable category navigation functionality.Fixed Positioning
The navbar remains visible during scroll, providing constant access to navigation.
