♻️ (builder) Change to features-centric folder structure

This commit is contained in:
Baptiste Arnaud
2022-11-15 09:35:48 +01:00
committed by Baptiste Arnaud
parent 3686465a85
commit 643571fe7d
683 changed files with 3907 additions and 3643 deletions

View File

@@ -0,0 +1,25 @@
import React from 'react'
import { ButtonProps, Button, useClipboard } from '@chakra-ui/react'
interface CopyButtonProps extends ButtonProps {
textToCopy: string
onCopied?: () => void
}
export const CopyButton = (props: CopyButtonProps) => {
const { textToCopy, onCopied, ...buttonProps } = props
const { hasCopied, onCopy } = useClipboard(textToCopy)
return (
<Button
isDisabled={hasCopied}
onClick={() => {
onCopy()
if (onCopied) onCopied()
}}
{...buttonProps}
>
{!hasCopied ? 'Copy' : 'Copied'}
</Button>
)
}