/** * Contain a button with a content that can be copied */ import React, { useState } from 'react'; import { faCheck, faCopy } from '@fortawesome/free-solid-svg-icons'; import { Button } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; interface ButtonCopyInterface { text: string; content: any; } const ButtonCopy = ({ text, content }: ButtonCopyInterface) => { const [check, setCheck] = useState(false); const handleCopy = () => { navigator.clipboard.writeText(content); setCheck(true); setTimeout(() => { setCheck(false); }, 3000); }; const icon = check ? faCheck : faCopy; return ( ); }; export default ButtonCopy;