import { useState } from 'react'; import ContentCopyIcon from '@mui/icons-material/ContentCopy'; import CheckIcon from '@mui/icons-material/Check'; import IconButton from '@mui/material/IconButton'; import { Tooltip } from '@mui/material'; import { SxProps, Theme } from '@mui/material'; interface CopyBubbleProps { content: string | undefined, sx?: SxProps; } const CopyBubble = ({ content, sx, } : CopyBubbleProps) => { const [copied, setCopied] = useState(false); const handleCopy = () => { if (content === undefined) { return; } navigator.clipboard.writeText(content.trim()).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2000); // Reset after 2 seconds }); }; return ( {copied ? : } ); } export { CopyBubble }