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

Refactor: Navigation components for improved route handling #40

Merged
merged 1 commit into from
Feb 8, 2025

Conversation

thejmitchener
Copy link
Member

@thejmitchener thejmitchener commented Feb 8, 2025

Pull Request Description: Refactor: Navigation components for improved route handling

Motivation:

This refactor enhances the navigation components to provide more robust route handling. The previous implementation relied on direct route name comparisons, which did not account for dynamic parameters or URL structures. This change aims to ensure that the navigation accurately reflects the current route, improving user experience by providing consistent active link states.

Key Improvements:

  1. Dynamic Route Handling: The updated components now parse the generated URLs and compare them against the current request path, allowing for better handling of routes with parameters and nested structures.

  2. Simplified Active State Logic: The logic to determine whether a link is active has been centralized and simplified. This ensures that dropdown links correctly reflect their active status based on the current route, enhancing usability.

  3. Consistency Across Components: The refactor applies similar logic across both mobile and desktop navigation components, ensuring a consistent approach to route handling throughout the application.

  4. Code Clarity and Maintainability: By removing redundant checks and streamlining the logic, the code is now easier to read and maintain. This will facilitate future enhancements and reduce the likelihood of bugs related to route management.

This refactor ultimately leads to a more reliable and user-friendly navigation experience in the application, ensuring that users can easily identify their current location within the site structure.

Updated navigation components to ensure accurate route matching by parsing URLs and checking active states across links and dropdowns. Refactored redundant logic and standardized handling of routes with parameters in both mobile and desktop navigation. Enhanced maintainability and consistency in dropdown components.
@thejmitchener thejmitchener merged commit 4b831d8 into main Feb 8, 2025
8 checks passed
@thejmitchener thejmitchener deleted the tweak-blog-nav-code branch February 8, 2025 19:34
fuelviews-app bot pushed a commit that referenced this pull request Feb 8, 2025
Updated navigation components to ensure accurate route matching by parsing URLs and checking active states across links and dropdowns. Refactored redundant logic and standardized handling of routes with parameters in both mobile and desktop navigation. Enhanced maintainability and consistency in dropdown components.
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