Skip to content

Conversation

@JounQin
Copy link
Collaborator

@JounQin JounQin commented Nov 28, 2025

Summary

render beforeNavMenu correctly

Related Issue

N/A

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings November 28, 2025 08:05
@netlify
Copy link

netlify bot commented Nov 28, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 8313e33
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/692957b5c5ec4700080080ad
😎 Deploy Preview https://deploy-preview-2822--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a 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 beforeNavMenu to prop destructuring in Layout component
  • Passed beforeNavMenu prop to Nav component
  • Repositioned beforeNavMenu rendering 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.

@JounQin JounQin requested a review from SoonIter November 28, 2025 09:00
</div>

<div className="rp-nav__right">
{beforeNavMenu}
Copy link
Member

Choose a reason for hiding this comment

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

是现在有在这之间插入组件的需求吗

Image

Copy link
Collaborator Author

@JounQin JounQin Nov 28, 2025

Choose a reason for hiding this comment

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

嗯,样式上跟后面的 nav menu 更贴近,感觉加到 search 前面比较奇怪?

image

我们原来的实现是用 portal render 到 .rspress-nav-menu,新版本这个 selector 没了,看了下 beforeNavMenu 比较合适

Copy link
Member

Choose a reason for hiding this comment

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

可以用 .rp-nav-menu

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if (leftOrRightMenuItems.length === 0) {
return null;
}

默认没渲染这个元素,现在的实现 beforeNavMenu 感觉应该是 beforeSearch 更符合语义。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants