-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
#377.2 QR-code/카카오톡/링크복사로 방 공유하기
- Loading branch information
Showing
37 changed files
with
1,055 additions
and
618 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useCallback } from "react"; | ||
|
||
import alertAtom from "atoms/alert"; | ||
import { useSetRecoilState } from "recoil"; | ||
|
||
type LinkCopyProps = { | ||
children: React.ReactNode; | ||
value: string; | ||
onCopy?: (value: string) => void; | ||
}; | ||
|
||
const LinkCopy = ({ children, value, onCopy }: LinkCopyProps) => { | ||
const setAlert = useSetRecoilState(alertAtom); | ||
const onClick = useCallback(() => { | ||
if (!navigator.clipboard) { | ||
setAlert("복사를 지원하지 않는 브라우저입니다."); | ||
return; | ||
} | ||
navigator.clipboard.writeText(value); | ||
if (onCopy) onCopy(value); | ||
}, [value, setAlert, onCopy]); | ||
return <a onClick={onClick}>{children}</a>; | ||
}; | ||
|
||
export default LinkCopy; |
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
Oops, something went wrong.