import toast, { Toaster } from 'react-hot-toast'; import copy from 'copy-to-clipboard' const Icon = ({icon, reference, copy = false} : {icon: any, reference: any, copy?: boolean}) => { return( <> { copy ? ( doThings(reference)}> {icon} ) : ( {icon} ) } ) } const doThings = (value: any) => { copy(value) toast.remove() toast.success('Successfully copied to clipboard', { style: { background: '#111', color: '#fff', fontSize: '1.1rem' } }) } export default Icon