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

fixes the active state of the naviagtion component #226

Conversation

siddhant-agrawal01
Copy link
Contributor

Description

This pull request addresses an issue where the "Button" component in the sidebar does not show as active when navigating to sub-routes like /components/button/neubrutalism-button. The changes ensure that the sidebar correctly highlights the "Button" component link when on any of its sub-routes.

Related Issue

#173

Fixes # (issue)

Proposed Changes

-> Modify the NavLink component to check if the pathname starts with the link's href to determine the active state.
-> Adjust the ActivePageMarker component to handle the same logic, ensuring correct highlighting in the sidebar.

  • ...

Screenshots

Screenshot from 2024-06-15 01-14-09

Screenshot from 2024-06-15 01-16-54

Checklist

Please check the boxes that apply:

  • [✅ ] I have rebased my branch on top of the latest main branch.
  • [✅ ] I have tested the changes locally
  • [✅ ] I ran npm run build and build is successful
  • I have added necessary documentation (if applicable)
  • I have updated the credits.md file (if applicable)

Copy link

vercel bot commented Jun 14, 2024

Someone is attempting to deploy a commit to the SyntaxUI Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@epoll31 epoll31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this PR work on your end?

On my end the PR doesn't change anything.

Screenshot 2024-06-14 at 5 26 54 PM

@@ -12,7 +12,7 @@ import {
} from '@/components/ui/table'

export const metadata = {
title: 'Skewed Infinite Scroll',
title: ' Infinite Scroll',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this title change?

@@ -38,14 +38,18 @@ function NavLink({
active?: boolean
isAnchorLink?: boolean
}) {
const isActive = usePathname().startsWith(href); //checking if the pathname starts with the link's href.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove isActive or active. It is confusing to have both isActive and active variables when only one is being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove active variable

@siddhant-agrawal01
Copy link
Contributor Author

Does this PR work on your end?

On my end the PR doesn't change anything.

Screenshot 2024-06-14 at 5 26 54 PM

It change the active state of navigation menu like the button component is become active when you choose specific button component
Screenshot from 2024-06-15 11-00-26
Screenshot from 2024-06-15 11-07-01

Copy link

vercel bot commented Jun 15, 2024

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

Name Status Preview Comments Updated (UTC)
syntax-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 15, 2024 3:41pm

@Ansub
Copy link
Member

Ansub commented Jun 15, 2024

Button's active state background disappears when navigating to a child element such as a 3D button.

CleanShot.2024-06-15.at.19.44.11.mp4

ton in this case

@siddhant-agrawal01
Copy link
Contributor Author

Button's active state background disappears when navigating to a child element such as a 3D button.

CleanShot.2024-06-15.at.19.44.11.mp4
ton in this case
Thanks for the clarification ,
let me try my best to fix that .

@siddhant-agrawal01
Copy link
Contributor Author

image
Button's active state background is now appears.what i use is that the background effect is applied only to the exact active route.but this way the introduction still remain active even when we navigate to button and its child component.
so how can i disable the introduction active state when going to button component(or any other component)?

@Ansub Ansub closed this Jun 23, 2024
@Ansub
Copy link
Member

Ansub commented Jun 23, 2024

fixed in #236

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.

3 participants