({ sx, text })
| 13 | } |
| 14 | |
| 15 | const CopyButton: React.FC<CopyButtonProps> = ({ sx, text }) => { |
| 16 | const [copied, setCopied] = React.useState(false); |
| 17 | const { isMobile } = useCheckViewport(); |
| 18 | |
| 19 | const handleCopy = () => { |
| 20 | setCopied(true); |
| 21 | setTimeout(() => { |
| 22 | setCopied(false); |
| 23 | }, 500); |
| 24 | }; |
| 25 | |
| 26 | return ( |
| 27 | <CopyToClipboard text={text} onCopy={handleCopy}> |
| 28 | <EditorTooltip title="Copied!" placement="top" open={copied}> |
| 29 | <IconButton sx={{ p: 0, ...sx }}> |
| 30 | {isMobile ? ( |
| 31 | <MobileCopySvg className="h-[auto] w-[32px]"></MobileCopySvg> |
| 32 | ) : ( |
| 33 | <CopySvg className="h-[auto] w-[40px]"></CopySvg> |
| 34 | )} |
| 35 | </IconButton> |
| 36 | </EditorTooltip> |
| 37 | </CopyToClipboard> |
| 38 | ); |
| 39 | }; |
| 40 | |
| 41 | export default CopyButton; |
nothing calls this directly
no test coverage detected