-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(design): replace 'Copied!' text with check icon in code block #5039
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,8 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React, { useState } from 'react'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Highlight from 'react-syntax-highlighter'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { CheckIcon } from '@heroicons/react/outline'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { twMerge } from 'tailwind-merge'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import Caption from '../Caption'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import IconClipboard from '../icons/Clipboard'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -333,13 +335,27 @@ export default function CodeBlock({ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| title='Copy to clipboard' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data-test='copy-button' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {showIsCopied && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className='mr-2 inline-block pl-2 pt-1' data-testid='clicked-text'> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Copied! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="relative inline-block mt-[3px] size-4"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className={twMerge( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'absolute inset-0 transition-all duration-200 ease-out', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showIsCopied | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? 'opacity-0 scale-50' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : 'opacity-100 scale-100', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <IconClipboard /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className={twMerge( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 'absolute inset-0 transition-all duration-200 ease-out', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showIsCopied | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ? 'opacity-100 scale-100' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| : 'opacity-0 scale-50', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <CheckIcon /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+338
to
358
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix formatting issues to pass CI. Multiple linting/formatting errors are causing the pipeline to fail:
🔧 Proposed fix for formatting issues- <span className="relative inline-block mt-[3px] size-4">
+ <span className='relative inline-block mt-[3px] size-4'>
<span
className={twMerge(
'absolute inset-0 transition-all duration-200 ease-out',
- showIsCopied
- ? 'opacity-0 scale-50'
- : 'opacity-100 scale-100',
+ showIsCopied ? 'opacity-0 scale-50' : 'opacity-100 scale-100'
)}
>
<IconClipboard />
</span>
<span
className={twMerge(
'absolute inset-0 transition-all duration-200 ease-out',
- showIsCopied
- ? 'opacity-100 scale-100'
- : 'opacity-0 scale-50',
+ showIsCopied ? 'opacity-100 scale-100' : 'opacity-0 scale-50'
)}
>
<CheckIcon />
</span>
</span>📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Actions: PR testing - if Node project[error] 338-338: Replace "relative·inline-block·mt-[3px]·size-4" with 'relative·inline-block·mt-[3px]·size-4' prettier/prettier [error] 338-338: Unexpected usage of doublequote. jsx-quotes [error] 342-342: Replace [error] 344-344: Unexpected trailing comma. comma-dangle [error] 352-352: Replace [error] 354-354: Unexpected trailing comma. comma-dangle 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className='inline-block pt-1'> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <IconClipboard className='-mt-0.5 inline-block size-4' /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Fix import sorting to pass CI.
The pipeline is failing due to import order not matching the project's
simple-import-sortconfiguration. The imports need to be reordered.🔧 Proposed fix for import sorting
import React, { useState } from 'react'; + +import { CheckIcon } from '@heroicons/react/outline'; import Highlight from 'react-syntax-highlighter'; +import { twMerge } from 'tailwind-merge'; -import { CheckIcon } from '@heroicons/react/outline'; -import { twMerge } from 'tailwind-merge'; import Caption from '../Caption'; import IconClipboard from '../icons/Clipboard';Note: The exact order depends on the project's
simple-import-sortconfiguration. Runnpm run lint:fixor the equivalent autofix command to get the correct order.🤖 Prompt for AI Agents