-
Notifications
You must be signed in to change notification settings - Fork 1.4k
add a scrollbar for nav links in the header when they exceed available free space #3376
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
Conversation
🦋 Changeset detectedLatest commit: 4e8dcaf The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
📦 Next.js Bundle Analysis for swr-siteThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
Page | Size (compressed) |
---|---|
global |
167.27 KB (🟡 +17 B) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
📦 Next.js Bundle Analysis for docsThis analysis was generated by the Next.js Bundle Analysis action. 🤖
|
Page | Size (compressed) |
---|---|
global |
174.98 KB (15 B) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Twelve Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
Page | Size (compressed) | First Load |
---|---|---|
/about |
8.09 KB (🟢 -1 B) |
183.07 KB |
/docs/blog-theme/start |
14.11 KB (-1 B) |
189.09 KB |
/docs/docs-theme/built-ins |
7.65 KB (🟢 -1 B) |
182.63 KB |
/docs/guide/advanced/customize-the-cascade-layers |
7.66 KB (🟢 3 B) |
182.64 KB |
/docs/guide/advanced/npm2yarn |
10.74 KB (-1 B) |
185.71 KB |
/docs/guide/advanced/tailwind-css |
7.26 KB (🟢 1 B) |
182.24 KB |
/docs/guide/advanced/twoslash-support |
9.29 KB (🟢 -1 B) |
184.27 KB |
/docs/guide/custom-css |
7.15 KB (🟢 3 B) |
182.13 KB |
/docs/guide/i18n |
8.31 KB (🟢 -1 B) |
183.28 KB |
/docs/guide/image |
8.37 KB (🟢 -2 B) |
183.35 KB |
/docs/guide/organize-files |
11.31 KB (-1 B) |
186.29 KB |
/docs/guide/static-exports |
11.27 KB (-1 B) |
186.25 KB |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link
is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script>
tag are not accounted for in this analysis
Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by undefined% or more, there will be a red status indicator applied, indicating that special attention should be given to this.
cc @87xie lmk wdyt 🙏 |
I think each approach is quite subjective, and it might be more appropriate to leave these trade-offs to the outer-land. If Nextra v3 could provide lower-level components that allow users to compose their components (similar to the approach in v4): <Navbar>
<MyLogo />
<MyLinks />
<Searchbar />
<ProjectLink />
</Navbar> This would give them the flexibility to implement the solutions that might be more suitable for their use case, for example, prioritizing the hiding of less important elements, using overflow: scroll, or dynamically calculating with JavaScript. My use case with theme-docs doesn't involve a complex header, so I’m unable to provide useful suggestions 😅 |
thanks for adding this (just noticed it and was looking for the pr)! we use theme-docs for our main website and docs and would love to customize the main nav more easily as described by @87xie |
@@ -127,47 +127,51 @@ export function Navbar({ items }: NavBarProps): ReactElement { | |||
{renderComponent(themeConfig.logo)} | |||
</div> | |||
)} | |||
{items.map(pageOrMenu => { | |||
if (pageOrMenu.display === 'hidden') return null | |||
<div className="_flex _gap-4 _overflow-x-auto nextra-scrollbar _py-1.5"> |
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.
yeah, noticed it too, little regression
fixes #2785
inspired by mdx website
Screen.Recording.2024-10-05.at.12.32.37.mov
TODO
maybe add a box-shadow to help users understand there is a scroll like in the sidebar and TOC footers?
nextra/packages/nextra-theme-docs/css/styles.css
Line 161 in 1c44794