-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Proposal change to the copied code #852
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
Proposal change to the copied code #852
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
that looks good, would you like to apply to all so it's consistent? perhaps a custom hook for the job. |
Yeah. Make sense create for all. I'll change the PR. |
@bluebill1049 I created a component I change on this pages/components: I searched the whole project and couldn't find any more alerts modal with clipboard. |
I fixed a small issue on Test case for this bug: |
thanks a lot for making this happend. 👍 |
Thanks you for this beautiful library! |
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.
Looks great, just one minor feedback.
className?: string | ||
currentLanguage: string | ||
}) => { | ||
const [copiedCode, setCopiedCode] = useState<boolean>(false) |
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.
worth adding a ref with setTimeout in case of a memory leak.
const timer = useRef()
React.useEffect(() => () => clearTime(timer.current))
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 will address this tho, thanks for the awesome work!
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.
done :) a336981
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.
Excellent point! Thanks so much.
Description
We are currently opening an
alert
to let you know that the code has been copied. My proposal is to improve the user experience by informing on the button itself that the code is already copied in its transfer area. If this change makes sense, we create this action for the others copy buttons.BEFORE
AFTER