Skip to content

ref(platform): Further streamlining of sidebar nav code #13370

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

Merged
merged 5 commits into from
Apr 15, 2025

Conversation

mydea
Copy link
Member

@mydea mydea commented Apr 14, 2025

This is a further refactor/streamlining of the sidebar components.
This is preparation to allow easier exploration/experimentation of new sidebar designs, which right now was a bit tricky because the code was spread all over the place.

This PR:

  • Moves all the sidebar-specific components into the sidebar folder
  • Streamlines the code to use <SidebarLink> everywhere, which also encapsulates the respective styles needed
  • Adds a <CollapsibleSidebarLink> component to handle the DynamicNav use case (client component)
  • Adds a <SidebarSeparator> component to allow specific styling of this vs. implicit hierarchy styling of <hr>
  • Streamlines margins of the nav item on top (e.g. Sentry for React above the product docs)
  • Removes the "DefaultSidebar" which was not really used anymore and was visually broken anyhow. Now it is clear that this case should not happen, it will throw an error.
  • Streamlined external links in the sidebar
  • Removed duplicate chevron code in favor of the existing component
  • Renamed SidebarLinks to SidebarNavigation for better clarity/to avoid confusing with SidebarLink

@mydea mydea requested review from a-hariti and chargome April 14, 2025 07:49
@mydea mydea self-assigned this Apr 14, 2025
Copy link

vercel bot commented Apr 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
develop-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 14, 2025 0:15am
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 14, 2025 0:15am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Apr 14, 2025 0:15am

Copy link

codecov bot commented Apr 14, 2025

Bundle Report

Changes will decrease total bundle size by 1.18kB (-0.01%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 11.13MB -1.9kB (-0.02%) ⬇️
sentry-docs-client-array-push 9.47MB 719 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 868.7kB -0.0%
static/css/*.css -70 bytes 13.98kB -0.5%
static/css/*.css 24 bytes 739.65kB 0.0%
static/chunks/8165-*.js -3 bytes 410.1kB -0.0%
static/chunks/353-*.js (New) 276.51kB 276.51kB 100.0% 🚀
server/app/_not-*.js 19 bytes 255.87kB 0.01%
server/app/[[...path]]/page_client-*.js 19 bytes 255.83kB 0.01%
server/app/platform-*.js 19 bytes 241.57kB 0.01%
static/chunks/6442-*.js (New) 119.63kB 119.63kB 100.0% 🚀
static/chunks/404-*.js (New) 43.41kB 43.41kB 100.0% 🚀
static/chunks/4746-*.js 114 bytes 20.32kB 0.56%
static/chunks/app/platform-*.js 2 bytes 12.94kB 0.02%
static/7mqqev7-*.js (New) 77 bytes 77 bytes 100.0% 🚀
static/7mqqev7-*.js (New) 578 bytes 578 bytes 100.0% 🚀
static/chunks/463-*.js (Deleted) -254.43kB 0 bytes -100.0% 🗑️
static/chunks/7992-*.js (Deleted) -141.72kB 0 bytes -100.0% 🗑️
static/chunks/818-*.js (Deleted) -42.81kB 0 bytes -100.0% 🗑️
static/AGvcwaqWwgCW4BwPGXYjs/_buildManifest.js (Deleted) -578 bytes 0 bytes -100.0% 🗑️
static/AGvcwaqWwgCW4BwPGXYjs/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️

Files in static/chunks/404-*.js:

  • ./src/components/platformSelector/index.tsx → Total Size: 20.0kB

  • ./src/components/sidebar/collapsibleSidebarLink.tsx → Total Size: 1.93kB

Files in static/chunks/4746-*.js:

  • ./src/components/sidebar/style.module.scss → Total Size: 362 bytes
view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.75MB -0.0%
../instrumentation.js -3 bytes 1.08MB -0.0%
9523.js -3 bytes 1.05MB -0.0%
../app/[[...path]]/page.js 22.91kB 583.13kB 4.09%
4835.js (New) 190.49kB 190.49kB 100.0% 🚀
9273.js (New) 82.74kB 82.74kB 100.0% 🚀
../app/platform-redirect/page.js 1 bytes 31.04kB 0.0%
7269.js 114 bytes 29.8kB 0.38%
9081.js (Deleted) -216.17kB 0 bytes -100.0% 🗑️
2065.js (Deleted) -81.98kB 0 bytes -100.0% 🗑️

Files in 9273.js:

  • ./src/components/sidebar/style.module.scss → Total Size: 356 bytes

  • ./src/components/sidebar/dynamicNav.tsx → Total Size: 4.17kB

  • ./src/components/sidebar/style.module.scss → Total Size: 356 bytes

  • ./src/components/sidebar/developDocsSidebar.tsx → Total Size: 4.0kB

  • ./src/components/sidebar/sidebarNavigation.tsx → Total Size: 3.16kB

  • ./src/components/sidebar/productSidebar.tsx → Total Size: 3.79kB

  • ./src/components/sidebar/collapsibleSidebarLink.tsx → Total Size: 522 bytes

  • ./src/components/platformSelector/index.tsx → Total Size: 18.91kB

  • ./src/components/platformSelector/index.tsx → Total Size: 490 bytes

  • ./src/components/sidebar/index.tsx → Total Size: 5.2kB

  • ./src/components/sidebar/collapsibleSidebarLink.tsx → Total Size: 1.86kB

App Routes Affected:

App Route Size Change Total Size Change (%)
/[[...path]] 22.91kB 3.13MB 0.74%
/ 114 bytes 2.61MB 0.0%
/platform-redirect 1 bytes 2.58MB 0.0%

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

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

Nice refactor, thanks! Looks like some style properties got lost though:

Screenshot 2025-04-14 at 10 25 40

</SidebarLink>
</ul>
<hr />
<div className={`${styles.toc} mt-3`}>
Copy link
Member

Choose a reason for hiding this comment

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

Does styles.toc actually exist?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch! removed this, and fixed the styling to be bold as well there in 778c708

@mydea mydea merged commit 464dfe2 into master Apr 15, 2025
13 checks passed
@mydea mydea deleted the fn/sidebar-refactor branch April 15, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants