-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
fix: improve clipboard success animation in code blocks (#7946) #7950
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: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Does setting the swipeDirection
not do all of this for you?
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.
swapDirection
only indicates the direction of the animation. It only takes effect once the appropriate animation classes are added in the CSS module.
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.
I am not sure about animation is required or not. But this implementation follows radix docs.
LGTM!
|
||
.root[data-state='open'] { | ||
animation: slide-in 300ms cubic-bezier(0.16, 1, 0.3, 1); | ||
} | ||
|
||
.root[data-state='closed'] { | ||
animation: slide-out 200ms ease-in forwards; | ||
} | ||
|
||
.root[data-swipe='move'] { | ||
transform: translateX(var(--radix-toast-swipe-move-x)); | ||
} | ||
|
||
.root[data-swipe='cancel'] { | ||
transform: translateX(0); | ||
transition: transform 200ms ease-out; | ||
} | ||
|
||
.root[data-swipe='end'] { | ||
animation: swipe-out 150ms ease-out forwards; | ||
} |
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.
A) I'm not sure how I feel about the added complexity of a swipe
B) use tailwinds @apply
Description
Improves the clipboard success animation for code blocks.
The previous animation was abrupt and barely visible, which felt out of place compared to the otherwise modern UI. This PR introduces a smoother transition, to improve visibility and user experience.
Validation
Tested locally by clicking the copy button on multiple code blocks.
The new animation is clearly visible, smoother, and feels more consistent with the design language of the site.
Related Issues
Fixes #7946
Check List
pnpm format
to ensure the code follows the style guide.pnpm test
to check if all tests are passing.pnpm build
to check if the website builds without errors.Screen.Recording.2025-07-04.at.3.09.44.PM.mov