-
Notifications
You must be signed in to change notification settings - Fork 211
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
feat: Button to copy the contents of the Migration tab to the clipboard #104
base: main
Are you sure you want to change the base?
feat: Button to copy the contents of the Migration tab to the clipboard #104
Conversation
…gration tab to the clipboard
@krisnaw is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
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.
Great work @krisnaw! Just a few small comments.
interface ButtonCopyCodeProps { | ||
code?: string; | ||
} |
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 few things:
- Let's make this a type (vs interface) just to be consistent with the other components (and export it)
- Any good reason to make
code
optional? Probably a clearer contract to make this required, and then upstream components can conditionally render the copy button if the value is optional. - Maybe we just call this
CopyButton
with avalue
prop so that it is more generic and can be used outside code block if we want in the future
<Button | ||
variant="outline" | ||
size="icon" | ||
className="absolute top-4 right-4 z-10" |
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.
Let's move layout logic upstream so that this button can be reused more generally.
Hi @gregnr, thanks for your feedback! Here are the updates I've made:
|
What kind of change does this PR introduce?
This PR introduces a new Button component that allows users to easily copy the contents of the Migration tab to their clipboard.
What is the current behavior?
Currently, users cannot directly copy the Migration tab's contents.
From this feature request #57
What is the new behavior?
When the button is clicked, its icon will change to a Check icon, indicating that the copy operation has been initiated. Once the copy is complete, the icon will revert to the original Copy icon.
Additional context