Repository navigation
feat(ui): add ghost copy button for single-line code blocks (#9085) - #9297
Open
hrithiksaini99 wants to merge 1 commit into
Open
hrithiksaini99 wants to merge 1 commit into
hrithiksaini99 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Comment on lines
+112
to
+113
| <ButtonIcon className="size-4" /> | ||
| {copied ? copiedButtonLabel : copyButtonLabel} |
Member
There was a problem hiding this comment.
IMO you should use 2 icon to mark as copied and you shouldn't use text
ovflowd
reviewed
Nov 3, 2026
|
|
||
| import BaseCodeBox from '../index'; | ||
|
|
||
| navigator.clipboard = { writeText: () => Promise.resolve() }; |
Member
There was a problem hiding this comment.
note: globals should NOT be mocked outside of a test environment. This here will propagate to all unit tests. Please change that :)
ovflowd
reviewed
Nov 3, 2026
| <ButtonIcon className="size-4" /> | ||
| {copied ? copiedButtonLabel : copyButtonLabel} | ||
| </BaseButton> | ||
| ) : !language ? null : ( |
Member
There was a problem hiding this comment.
Can you make separate {} checks, instead of chaining these?
ovflowd
reviewed
Nov 3, 2026
| } | ||
| } | ||
|
|
||
| & > .ghostAction { |
Member
There was a problem hiding this comment.
Please add screenshots on how it looks on the PR description for dark/light theme 🙇
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Single-line code blocks (marked with
no-footerby rehype-shiki) do not display the bottom toolbar to conserve vertical UI space, which left them without a quick copy action.This PR adds a ghost copy button for single-line code blocks that:
opacity-0by default,opacity-100on:hover/:focus-within).pr-24) to single-line code blocks so overflowing text is never occluded.BaseCodeBoxcovering default footer rendering, ghost copy button rendering onno-footer, and clipboard copy interactions.Validation
pnpm --filter @node-core/ui-components test: 46 passing tests (including new unit tests forBaseCodeBox).pnpm --filter @node-core/ui-components lint: 0 errors.pnpm --filter @node-core/ui-components build: Clean build.Related Issues
Fixes #9085
Check List
pnpm formatto ensure the code follows the style guide.pnpm testto check if all tests are passing.pnpm buildto check if the website builds without errors.