Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Header and ToggleSwitch Components to Close Navbar on Theme Toggle #739

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

saadrasheeddev
Copy link

Overview:
This update improves user experience by automatically closing the navigation menu when the theme is toggled in the header. This change ensures that users receive immediate feedback when switching between light and dark modes, maintaining a clean interface.

Changes Made:

  1. Header Component:

    • Introduced a useRef hook to manage the state of the menu checkbox.
    • Added a handleMenuItemClick function to programmatically uncheck the menu when a menu item is clicked or the theme is toggled.
    • Passed handleMenuItemClick as a prop to the ToggleSwitch component for integration.
  2. ToggleSwitch Component:

    • Updated to accept the handleMenuItemClick function as a prop.
    • Called handleMenuItemClick within the onChange event of the checkbox, ensuring the navbar closes when the theme is toggled.

Benefits:

  • Improved user experience by ensuring that the navigation menu closes upon theme change, preventing any UI clutter.
  • Maintained functionality and responsiveness of the header component.

Related Issues:

Testing:

  • Verified that toggling the theme properly closes the navbar.
  • Ensured all existing functionalities of the header and toggle switch remain intact.

Copy link

vercel bot commented Oct 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
developer-folio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 19, 2024 4:32am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant