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

feat: Add NavLink component with dynamic className support #2538

Closed
4 tasks done
manuelbento19 opened this issue Jun 21, 2024 · 1 comment
Closed
4 tasks done

feat: Add NavLink component with dynamic className support #2538

manuelbento19 opened this issue Jun 21, 2024 · 1 comment
Assignees
Labels
⭐ goal: addition Addition of new feature 🏁 status: ready for dev Ready for work

Comments

@manuelbento19
Copy link
Contributor

What feature?

Description

Currently, I am proposing to add a NavLink component to the project with support for defining className dynamically. This will allow for greater flexibility in styling links based on different conditions.

Proposed Implementation Details

The NavLink component will be developed with the following characteristics:

  • Will extend Next.js LinkProps props.
  • Will include support for dynamic className, which can be a static string or a function that returns a CSS class string.
  • Will use usePathname (or equivalent functionality) to determine whether the link is active, applying the appropriate CSS class based on the current URL.

Example of use

import NavLink from 'components/NavLink';

<NavLink href="/dashboard" className={(active) => active ? 'active-link' : 'inactive-link'}>
  Dashboard
</NavLink>

Add screenshots

image

Record

@manuelbento19 manuelbento19 added ⭐ goal: addition Addition of new feature 🚦status: awaiting triage Has not been triaged & therefore, not ready for work labels Jun 21, 2024
Copy link

To reduce notifications, issues are locked. Your issue will be unlock when we will add label as 🏁 status: ready for dev. Check out the contributing guide for more information.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2024
Repository owner unlocked this conversation Jun 21, 2024
@priyankarpal priyankarpal added 🏁 status: ready for dev Ready for work and removed 🚦status: awaiting triage Has not been triaged & therefore, not ready for work labels Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ goal: addition Addition of new feature 🏁 status: ready for dev Ready for work
Projects
None yet
Development

No branches or pull requests

2 participants