2023-03-14 11:06:57 +03:00
|
|
|
import { faClone as copyIcon } from '@fortawesome/free-regular-svg-icons';
|
2023-02-18 13:11:01 +03:00
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
|
import type { FC } from 'react';
|
2021-01-24 19:37:31 +03:00
|
|
|
import CopyToClipboard from 'react-copy-to-clipboard';
|
|
|
|
import './CopyToClipboardIcon.scss';
|
|
|
|
|
|
|
|
interface CopyToClipboardIconProps {
|
|
|
|
text: string;
|
|
|
|
onCopy?: (text: string, result: boolean) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export const CopyToClipboardIcon: FC<CopyToClipboardIconProps> = ({ text, onCopy }) => (
|
|
|
|
<CopyToClipboard text={text} onCopy={onCopy}>
|
2022-03-05 15:26:28 +03:00
|
|
|
<FontAwesomeIcon icon={copyIcon} className="ms-2 copy-to-clipboard-icon" />
|
2021-01-24 19:37:31 +03:00
|
|
|
</CopyToClipboard>
|
|
|
|
);
|