Skip to content

Conversation

@SumitMondal2311
Copy link

@SumitMondal2311 SumitMondal2311 commented Jan 29, 2026

Summary

Replaces the "Copied!" text feedback in code block copy interaction with a check icon for a cleaner, less intrusive UI.

Closes #5037

Summary by CodeRabbit

  • Style
    • Improved copy button visual feedback with icon-based indicators and smooth fade transitions, replacing the previous text label.

✏️ Tip: You can customize this high-level summary in your review settings.

@netlify
Copy link

netlify bot commented Jan 29, 2026

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 04fcb64
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/697b983bc99504000757e33a
😎 Deploy Preview https://deploy-preview-5039--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

The copy button feedback in the code block component is enhanced by replacing the "Copied!" text indicator with a two-icon toggle system that transitions between a clipboard icon and a check mark icon using opacity and scale animations.

Changes

Cohort / File(s) Summary
Copy Button Icon Toggle
components/editor/CodeBlock.tsx
Replaced text-based "Copied!" feedback with a dual-icon toggle (clipboard to check mark) featuring cross-fade transitions. Imports CheckIcon and twMerge; uses showIsCopied state to control visibility via opacity and scale transforms on overlaid icon spans.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 ✨ A clipboard dances with grace,
Then fades in a check's warm embrace,
No words need be spoken so clear,
With icons that vanish—hooray, it's here!
Copy magic, refined and sincere! 📋➔✓

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing 'Copied!' text with a check icon in code blocks, which aligns with the actual code modifications.
Linked Issues check ✅ Passed The PR implements the core requirement from issue #5037: replacing the 'Copied!' text feedback with a check icon using icon components and opacity/scale transitions for animation.
Out of Scope Changes check ✅ Passed All changes are scoped to the code block copy button feedback mechanism in CodeBlock.tsx, directly addressing issue #5037 with no unrelated modifications.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@components/editor/CodeBlock.tsx`:
- Around line 338-358: The JSX in the CodeBlock component has Prettier/ESLint
formatting issues: change double quotes to single quotes for JSX attributes
(e.g., className attributes on the span elements), remove trailing commas in
prop lists passed to twMerge, and collapse the ternary expressions used inside
twMerge onto single lines so each conditional is one line (affecting the
className calls that reference showIsCopied, IconClipboard, and CheckIcon).
Ensure the twMerge invocations and the two nested span elements use
single-quoted strings and no trailing commas and that the ternary operators are
formatted as single-line expressions.
- Around line 4-5: Import order in CodeBlock.tsx does not match the project's
simple-import-sort rules; reorder the imports so they comply (or run the
autofix). Open CodeBlock.tsx and adjust the two imports (CheckIcon from
'@heroicons/react/outline' and twMerge from 'tailwind-merge') into the order
expected by your simple-import-sort configuration (or simply run npm run
lint:fix to auto-fix), then re-run CI to confirm and commit the updated import
order.

Comment on lines +4 to +5
import { CheckIcon } from '@heroicons/react/outline';
import { twMerge } from 'tailwind-merge';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix import sorting to pass CI.

The pipeline is failing due to import order not matching the project's simple-import-sort configuration. 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-sort configuration. Run npm run lint:fix or the equivalent autofix command to get the correct order.

🤖 Prompt for AI Agents
In `@components/editor/CodeBlock.tsx` around lines 4 - 5, Import order in
CodeBlock.tsx does not match the project's simple-import-sort rules; reorder the
imports so they comply (or run the autofix). Open CodeBlock.tsx and adjust the
two imports (CheckIcon from '@heroicons/react/outline' and twMerge from
'tailwind-merge') into the order expected by your simple-import-sort
configuration (or simply run npm run lint:fix to auto-fix), then re-run CI to
confirm and commit the updated import order.

Comment on lines +338 to 358
<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>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix formatting issues to pass CI.

Multiple linting/formatting errors are causing the pipeline to fail:

  • Line 338: Use single quotes instead of double quotes for JSX attributes
  • Lines 344, 354: Remove trailing commas
  • Ternary operators should be on single lines per Prettier config
🔧 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<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>
<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>
</span>
🧰 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 ⏎······················?·'opacity-0·scale-50'⏎······················:·'opacity-100·scale-100', with ·?·'opacity-0·scale-50'·:·'opacity-100·scale-100' prettier/prettier


[error] 344-344: Unexpected trailing comma. comma-dangle


[error] 352-352: Replace ⏎······················?·'opacity-100·scale-100'⏎······················:·'opacity-0·scale-50', with ·?·'opacity-100·scale-100'·:·'opacity-0·scale-50' prettier/prettier


[error] 354-354: Unexpected trailing comma. comma-dangle

🤖 Prompt for AI Agents
In `@components/editor/CodeBlock.tsx` around lines 338 - 358, The JSX in the
CodeBlock component has Prettier/ESLint formatting issues: change double quotes
to single quotes for JSX attributes (e.g., className attributes on the span
elements), remove trailing commas in prop lists passed to twMerge, and collapse
the ternary expressions used inside twMerge onto single lines so each
conditional is one line (affecting the className calls that reference
showIsCopied, IconClipboard, and CheckIcon). Ensure the twMerge invocations and
the two nested span elements use single-quoted strings and no trailing commas
and that the ternary operators are formatted as single-line expressions.

@asyncapi-bot
Copy link
Contributor

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 37
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🔴 PWA 33

Lighthouse ran on https://deploy-preview-5039--asyncapi-website.netlify.app/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Be Triaged

Development

Successfully merging this pull request may close these issues.

[DESIGN]: Replace "Copied!" text with a check icon in code block "copy" interaction

2 participants