Skip to content

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.

License

Notifications You must be signed in to change notification settings

pro804/React-Dynamic-Navbar

Repository files navigation

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.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published