MCPcopy Create free account
hub / github.com/LevelUpWeb3/app / CopyButton

Function CopyButton

src/components/MDXCodeHighlighter/CopyButton.tsx:15–39  ·  view source on GitHub ↗
({ sx, text })

Source from the content-addressed store, hash-verified

13}
14
15const 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
41export default CopyButton;

Callers

nothing calls this directly

Calls 1

useCheckViewportFunction · 0.85

Tested by

no test coverage detected