Skip to content

Conversation

@cnaples79
Copy link

@cnaples79 cnaples79 commented Dec 26, 2025

Summary

  • replace toast-based copy confirmation with inline feedback on the code block button
  • reuse the existing copy hook to toggle button text/icon to "Copied" after clicking

Rationale

  • keeps feedback adjacent to the action and removes the global toast dependency (accessibility and clarity)

Changes

  • CodeBox now uses useCopyToClipboard state for inline status and no longer calls NotificationProvider
  • BaseCodeBox accepts an optional copied flag to swap the copy icon for a checkmark

Fixes #8357

@cnaples79 cnaples79 requested a review from a team as a code owner December 26, 2025 01:02
@vercel
Copy link

vercel bot commented Dec 26, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
nodejs-org Ready Ready Preview Dec 26, 2025 1:03am

@github-actions
Copy link
Contributor

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.83%. Comparing base (33f53a6) to head (68c4421).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8458      +/-   ##
==========================================
+ Coverage   73.78%   73.83%   +0.04%     
==========================================
  Files         109      109              
  Lines        9255     9255              
  Branches      314      313       -1     
==========================================
+ Hits         6829     6833       +4     
+ Misses       2424     2420       -4     
  Partials        2        2              

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

Copy link
Member

@mikeesto mikeesto left a comment

Choose a reason for hiding this comment

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

Looks good, thanks! Could you please run prettier on apps/site/components/Common/CodeBox.tsx to fix CI?

buttonText,
as = 'a',
showCopyButton = true,
copied = false,
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you should add this prop, you can change the buttonText prop to be of type ReactNode and pass the icon directly with the text.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

I believe you can remove the whole source of NotificationProvider, including tests, stories and remove it from the Layout too. Which would also allow you to remove the "use client" from the layout. (I think?)

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.

Replace Toast notifications with inline feedback for "Code Copied" action

3 participants