import classnames from 'classnames' import * as R from 'ramda' import React, { useState, useEffect } from 'react' import { CopyToClipboard as ReactCopyToClipboard } from 'react-copy-to-clipboard' import Popover from 'src/components/Popper.jsx' import CopyIcon from 'src/styling/icons/action/copy/copy.svg?react' import { comet } from 'src/styling/variables.js' import { Label1, Mono } from './typography/index.jsx' const CopyToClipboard = ({ className, buttonClassname, children, wrapperClassname, removeSpace = true }) => { const [anchorEl, setAnchorEl] = useState(null) useEffect(() => { if (anchorEl) setTimeout(() => setAnchorEl(null), 3000) }, [anchorEl]) const handleClick = event => { setAnchorEl(anchorEl ? null : event.currentTarget) } const handleClose = () => { setAnchorEl(null) } const open = Boolean(anchorEl) const id = open ? 'simple-popper' : undefined return (
{children && ( <> {children}
Copied to clipboard! )}
); } export default CopyToClipboard