We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8c4a5ca + 61495b0 commit 12cb10eCopy full SHA for 12cb10e
client/src/components/common/CopyButton/index.tsx
@@ -0,0 +1,21 @@
1
+import { BiCopy } from '@react-icons/all-files/bi/BiCopy';
2
+
3
+interface CopyButtonProps {
4
+ target: string;
5
+ className?: string;
6
+}
7
8
+function CopyButton({ target, className }: CopyButtonProps) {
9
+ const onCopy = async () => {
10
+ try {
11
+ await navigator.clipboard.writeText(target);
12
+ alert('참여 코드가 복사되었습니다.');
13
+ } catch (e) {
14
+ alert('실패');
15
+ }
16
+ };
17
18
+ return <BiCopy className={className} onClick={onCopy} />;
19
20
21
+export default CopyButton;
0 commit comments