-
-
Notifications
You must be signed in to change notification settings - Fork 199
fix: render beforeNavMenu correctly
#2822
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
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for rspress-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Pull request overview
This PR fixes the rendering of the beforeNavMenu prop, which was previously not being passed from the Layout component to the Nav component, preventing it from being displayed.
- Added
beforeNavMenuto prop destructuring in Layout component - Passed
beforeNavMenuprop to Nav component - Repositioned
beforeNavMenurendering in Nav component to appear after the Search component
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/core/src/theme/layout/Layout/index.tsx | Added beforeNavMenu to destructuring and passed it to the Nav component to enable rendering |
| packages/core/src/theme/components/Nav/index.tsx | Moved beforeNavMenu rendering position to after the Search component |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| </div> | ||
|
|
||
| <div className="rp-nav__right"> | ||
| {beforeNavMenu} |
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.
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.
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.
可以用 .rp-nav-menu
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.
rspress/packages/core/src/theme/components/Nav/NavMenu.tsx
Lines 138 to 140 in 6b80077
| if (leftOrRightMenuItems.length === 0) { | |
| return null; | |
| } |
默认没渲染这个元素,现在的实现 beforeNavMenu 感觉应该是 beforeSearch 更符合语义。


Summary
render
beforeNavMenucorrectlyRelated Issue
N/A
Checklist