feat(theme-docs): add ability to add custom links to navbar like project & chat links #2783
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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