Navbar
Component
For Dark - Light Mode
ThemeContext.tsx
:
layout.tsx
:
Dependencies
npmi lucide-react
Usage Methods
- Pass
navItems
as a prop to allow customisation of menu links. - Use a JSON file for
navItems
data to facilitate editing and extending links. - Outsource the search component to a separate component to improve modularity.
- Create a separate
MobileMenu
component to manage the mobile menu and improve code readability. - Pass the theme as a prop and manage it in a higher-level component to make the component more flexible.
- Handle clicks outside the mobile menu in a custom hook to make the code cleaner and reusable.
- Allow customisation of icons via props to allow different icons to be used.
- Add a prop to pass callback functions for menu and theme events to allow customised event handling.