bec84051a9
* feat: unified existing notification with notistack * chore: replaced with useSnackbar, added missing notifications * chore: removed FIXME as per PR review
25 lines
772 B
TypeScript
25 lines
772 B
TypeScript
import type { ReactElement } from 'react'
|
|
import IconButton from '@material-ui/core/IconButton'
|
|
import { CopyToClipboard } from 'react-copy-to-clipboard'
|
|
import { Clipboard } from 'react-feather'
|
|
import { useSnackbar } from 'notistack'
|
|
|
|
interface Props {
|
|
value: string
|
|
}
|
|
|
|
export default function ClipboardCopy({ value }: Props): ReactElement {
|
|
const { enqueueSnackbar } = useSnackbar()
|
|
const handleCopy = () => enqueueSnackbar(`Copied: ${value}`, { variant: 'success' })
|
|
|
|
return (
|
|
<div style={{ marginRight: '3px', marginLeft: '3px' }}>
|
|
<IconButton color="primary" size="small" onClick={handleCopy}>
|
|
<CopyToClipboard text={value}>
|
|
<Clipboard style={{ height: '20px' }} />
|
|
</CopyToClipboard>
|
|
</IconButton>
|
|
</div>
|
|
)
|
|
}
|