Skip to content

feat: improve copy code button with animated success state#630

Merged
Mayur-Pagote merged 2 commits into
Mayur-Pagote:mainfrom
Adi-Marathe:fix-copy-code-animation
Jun 2, 2026
Merged

feat: improve copy code button with animated success state#630
Mayur-Pagote merged 2 commits into
Mayur-Pagote:mainfrom
Adi-Marathe:fix-copy-code-animation

Conversation

@Adi-Marathe

Copy link
Copy Markdown

Description

Currently, when a user clicks the Copy Code button on the README design cards or template preview, only a toast notification is shown. This PR introduces a smooth, direct visual feedback animation on the button itself to make the interface feel more intuitive, responsive, and modern.

Changes Made

  • Added local isCopied state to the ComponentCard and TemplatePreview components.
  • Updated the Copy Code buttons to dynamically change their text to Copied and swap the icon to a Check/Tick (<Check />).
  • Added smooth, sliding pop-in/pop-out transitions between states using framer-motion (<AnimatePresence>).
  • Added a temporary success color (bg-green-500) to the button when clicked.
  • Maintained the original toast notification as secondary feedback.
  • Refactored several components importing from motion/react to use framer-motion instead, fixing a dependency resolution issue and removing the unused motion dependency.

Visual Proof

Please check the screen recording below to see the animated success states in action!

README-Design-Kit.mp4

Related Issue

Fixes #624

Checklist

  • Tested the changes locally.
  • Code follows the project's structure and coding style.
  • Ensured animations are smooth and do not cause layout shifts.

- Add smooth state transitions to 'Copy Code' buttons using framer-motion

- Switch button color and icon on success

- Consolidate animation imports to use 'framer-motion'
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

@Adi-Marathe is attempting to deploy a commit to the mayur-pagote's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Mayur-Pagote

Copy link
Copy Markdown
Owner

@Adi-Marathe amazing work

@Mayur-Pagote Mayur-Pagote added Easy This tag is used for issues/PRs that are easy and under the SWoC contributor. SSoC26 Label given to issues/PRs related to Social Summer of Code 2026 labels Jun 2, 2026
@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
readme-design-kit Ready Ready Preview, Comment Jun 2, 2026 3:07pm

@Mayur-Pagote

Copy link
Copy Markdown
Owner

@Adi-Marathe PR Build Check is failing, please fix it.

@Adi-Marathe

Copy link
Copy Markdown
Author

@Adi-Marathe PR Build Check is failing, please fix it.

ok

@Adi-Marathe

Copy link
Copy Markdown
Author

Hello @Mayur-Pagote
I have fixed the bulid error

Pleae check it out

@Mayur-Pagote Mayur-Pagote merged commit 4a67e16 into Mayur-Pagote:main Jun 2, 2026
3 checks passed
@Mayur-Pagote

Copy link
Copy Markdown
Owner

@Adi-Marathe thank you

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

Labels

Easy This tag is used for issues/PRs that are easy and under the SWoC contributor. SSoC26 Label given to issues/PRs related to Social Summer of Code 2026

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement] Improve Copy Button Feedback for README Design Cards

2 participants