GitHunt
PR

pro804/React-Dynamic-Navbar

A React portfolio project featuring a dynamic navbar with submenus & mobile sidebar. Implements 3D animations, Context API state management, and responsive design. Built with Vite.

React Dynamic Navbar โšก๐Ÿงญ

React
Vite
Netlify
JavaScript
License: MIT

A modern, responsive navigation bar with dynamic submenus, built with React and Context API. Features smooth 3D animations, mobile-first responsive design, and inspired by Strapi CMS admin panel. Perfect for practicing React hooks, global state management, and advanced UI interactions.

๐Ÿš€ Live Demo

View Live on Netlify:
React Dynamic Navbar Demo

๐Ÿ“ธ Project Preview

๐Ÿ’ป Desktop View with Submenus
Desktop View showing dynamic submenus
๐Ÿ“ฑ Mobile View with Sidebar
Mobile View showing sidebar navigation
Responsive design with mobile sidebar and desktop submenus

๐ŸŽจ Inspiration & Design

  • Design Inspiration: UI patterns inspired by Strapi headless CMS admin panel
  • Figma Design: Original design provided by course instructor View Figma Design
  • Custom Implementation: Built from scratch with custom React implementation and rebranded as "Dynamic Navbar"
  • Responsive Behavior: Mobile sidebar toggle and desktop hover submenus

โœจ Features

  • Dynamic Submenus -Smooth 3D flip animations on desktop hover
  • Mobile-First Sidebar -Full-screen navigation for mobile devices
  • Global State Management-Context API for shared state across components
  • Responsive Design -Seamless transition between mobile and desktop views
  • Precise Mouse Tracking -Advanced boundary detection for submenu dismissal
  • Responsive Typography -Fluid text scaling with CSS clamp() for optimal readability
  • Customizable Data Structure -Easy to modify menu items and structure

๐Ÿ› ๏ธ Built With

Tool / Library Purpose
โšก Vite Fast build tool & dev server
โš›๏ธ React 19 Component-based UI
๐ŸŽฏ Context API Global state management
๐Ÿ“‹ React Icons Icon library for menu items
๐Ÿ”‘ Nanoid Unique ID generation
๐ŸŽจ CSS3 3D transforms, transitions, Grid

๐ŸŽ“ Key Learning Outcomes

Advanced State Management

  • Context API Implementation for global state sharing
  • Complex State Logic managing sidebar, submenus, and active states
  • Custom Hook Creation (useGlobalContext) with error handling

UI/UX & Animations

  • 3D Transformations with CSS perspective and rotateX
  • Smooth Transitions for sidebar and submenu animations
  • Responsive Breakpoints with mobile-first approach
  • Precise Mouse Event Handling with bounding client rect

Component Architecture

  • Modular Component Structure with clear separation of concerns
  • Dynamic Data Rendering from external data source
  • Conditional Rendering based on screen size and state
  • Event Delegation Patterns for efficient event handling

Performance & UX

  • Optional Chaining for safe data access
  • Dynamic Grid Layouts based on content length
  • Z-index Management for proper layer stacking
  • Accessibility Considerations with semantic HTML

๐Ÿ—๏ธ Component Architecture

src/
โ”œโ”€โ”€ components/
โ”‚ โ”œโ”€โ”€ Navbar.jsx # Main navigation with logo and toggle
โ”‚ โ”œโ”€โ”€ NavLinks.jsx # Desktop navigation links
โ”‚ โ”œโ”€โ”€ Sidebar.jsx # Mobile sidebar navigation
โ”‚ โ”œโ”€โ”€ Submenu.jsx # Desktop dropdown submenus
โ”‚ โ””โ”€โ”€ Hero.jsx # Main content section
โ”œโ”€โ”€ contexts/
โ”‚ โ”œโ”€โ”€ AppContext.js # React context creation
โ”‚ โ””โ”€โ”€ AppProvider.jsx # Global state provider
โ”œโ”€โ”€ hooks/
โ”‚ โ””โ”€โ”€ useGlobalContext.js # Custom context hook
โ””โ”€โ”€ data.jsx # Menu structure and content

๐Ÿš€ Getting Started

Prerequisites

  • Node.js โ‰ฅ 18.0.0
  • npm or yarn package manager

Installation

  1. Clone the repository
git clone https://github.com/pro804/React-Dynamic-Navbar.git
  1. Navigate to the project directory
cd React-Dynamic-Navbar
  1. Install dependencies
npm install
  1. Start the development server
npm run dev
  1. Open http://localhost:5173 to view it in the browser.

๐Ÿ”ง Available Scripts

  • npm run dev โ€” Runs the development server (Vite)
  • npm run build โ€” Builds the app for production
  • npm run preview โ€” Previews the production build locally

๐Ÿ“„ License

This project was created for educational purposes as part of a React learning journey.
This project is licensed under the MIT License.
See the LICENSE file for details.