-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(theme-docs): add ability to add custom links to navbar like project & chat links #2783
base: main
Are you sure you want to change the base?
Conversation
instead of just having chat & project link to display links with icons next to the searchbar in the navbar now you can add as many "icon links" as you want remain chat & project link for backwards compatibility but push them to the array of links that get rendered that also contains eventual custom links set from the config
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
@itsmaty is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not to use navbar.extraContent
to add customizable content?
Technically you can use I just think its easier that if you want to add more buttons you have an config where you can add a button object and it just works. It's your decision whether you think it improves nextra and is useful or not. For me it is. |
Previously you could add only two (project & chat link), you could change the icon & link to use these for completely other links but the internal names always where chat & project link and as said you where hardcoded limited to two links which in my opinion was a bad design decision, maybe there was a reason when it was developed.
Now you can add as many links with icons as you want while still supporting "chat" & "project" in the config for backwards compatibility.
You can now use "links" in the config which is an array of link components with and "link" and an "icon" property.
Internally this array just gets mapped over and renders all link components. To have said backwards compatibility the icon & chat link (if set), just get pushed to the links array.
Maybe there is a better solution than using useEffect to pus project & chat link to the links array as you can see i did in the code.
I tested the functionality, works great.
Would love to see this feature in v3.
Best regards,
Matthias