Skip to content

chore(ui): simplify CodeBox-like UI components #7793

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 2 commits into from
Jun 1, 2025

Conversation

avivkeller
Copy link
Member

This PR does a 2 similar things in order to enhance the integration with nodejs/api-docs-tooling#285

  1. It removes the part of BaseCodeBox not part of the actual UI component
  2. It moves MDXCodeTabs to the UI components

@Copilot Copilot AI review requested due to automatic review settings May 30, 2025 15:12
@avivkeller avivkeller requested a review from a team as a code owner May 30, 2025 15:13
Copy link

vercel bot commented May 30, 2025

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

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview May 31, 2025 2:52pm

Copy link
Contributor

@Copilot 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 simplifies the UI components used for code display by removing non-UI logic from BaseCodeBox and moving MDXCodeTabs into the UI components package. The key changes are:

  • Upgrading the Radix UI Tabs dependency in package.json.
  • Updating import paths in MDXCodeTabs to reflect the new component location.
  • Removing unnecessary notification elements and simplifying the onCopy API in BaseCodeBox, with corresponding adjustments in CodeBox.

Reviewed Changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/ui-components/package.json Upgraded @radix-ui/react-tabs dependency version from 1.1.3 to 1.1.9
packages/ui-components/MDX/CodeTabs.tsx Updated import path for CodeTabs to use the alias "#ui"
packages/ui-components/Common/CodeTabs/index.stories.tsx Replaced copyText and copiedText with buttonText in story props
packages/ui-components/Common/BaseCodeBox/index.tsx Removed unused icons and simplified the onCopy API signature
packages/ui-components/Common/BaseCodeBox/index.module.css Removed the unused .notification CSS rules
apps/site/next.mdx.use.client.mjs Updated MDXCodeTabs import to use the UI components package
apps/site/components/Common/CodeBox.tsx Adjusted onCopy implementation to align with the new BaseCodeBox API
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

packages/ui-components/MDX/CodeTabs.tsx:4

  • Ensure that the alias '#ui' is properly configured in the project to resolve the CodeTabs component.
import CodeTabs from '#ui/Common/CodeTabs';

packages/ui-components/Common/BaseCodeBox/index.tsx:69

  • The onCopy API has been simplified by removing the message parameter; please verify that all consumers have been updated to use the new signature.
onCopy: (text: string) => void;

Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.37%. Comparing base (3ecfbcb) to head (d2d1b79).
Report is 7 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7793      +/-   ##
==========================================
+ Coverage   75.34%   75.37%   +0.02%     
==========================================
  Files          96       96              
  Lines        7862     7862              
  Branches      192      192              
==========================================
+ Hits         5924     5926       +2     
+ Misses       1937     1935       -2     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

github-actions bot commented May 30, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟠 80 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 99 🟢 100 🟢 100 🟠 82 🔗
/en/about/previous-releases 🟢 100 🟢 100 🟢 100 🟠 83 🔗
/en/download 🟢 98 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 100 🟢 100 🟢 96 🟢 92 🔗

Co-authored-by: Claudio W. <[email protected]>
Signed-off-by: Aviv Keller <[email protected]>
@avivkeller avivkeller added this pull request to the merge queue Jun 1, 2025
Merged via the queue into main with commit e9ec33a Jun 1, 2025
21 checks passed
@avivkeller avivkeller deleted the chore/ui-codebox-chores branch June 1, 2025 10:21
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.

4 participants