This repository has been archived by the owner on Jul 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e84f86
commit e84f466
Showing
5 changed files
with
124 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
// @flow | ||
import React from 'react'; | ||
import {withSnackbar, WithSnackbarProps} from 'notistack'; | ||
import {CopyToClipboard} from 'react-copy-to-clipboard'; | ||
import {ReactComponent as CopyIcon} from 'v2/assets/icons/copy.svg'; | ||
|
||
import useStyles from './styles'; | ||
|
||
const CopyBtn = ({text}: {text: string | number}) => { | ||
const CopyBtn = ({ | ||
text, | ||
enqueueSnackbar, | ||
}: {text: string | number} & WithSnackbarProps) => { | ||
const classes = useStyles(); | ||
const onCopy = () => { | ||
enqueueSnackbar('Successfully copied to clipboard', { | ||
variant: 'success', | ||
autoHideDuration: 2000, | ||
}); | ||
}; | ||
return ( | ||
<CopyToClipboard text={text}> | ||
<CopyToClipboard text={text} onCopy={onCopy}> | ||
<div className={classes.root}> | ||
<CopyIcon /> | ||
</div> | ||
</CopyToClipboard> | ||
); | ||
}; | ||
|
||
export default CopyBtn; | ||
export default withSnackbar(CopyBtn); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters