-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: react-copy-to-clipboard 라이브러리 추가 * feat: copy link 컴포넌트 만들고 적용 * feat: 제거 - SurveyIdLoaded * feat: 클립보드 로직 변경 * refactor: 사용하지 않는 부분 제거
- Loading branch information
Showing
13 changed files
with
167 additions
and
50 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.
Binary file added
BIN
+3.22 KB
.yarn/cache/@types-react-copy-to-clipboard-npm-5.0.4-cc4f7d72b2-c0fe51b79a.zip
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+15.5 KB
.yarn/cache/react-copy-to-clipboard-npm-5.1.0-de9742f2bc-f00a4551b9.zip
Binary file not shown.
Binary file not shown.
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,29 @@ | ||
import { type PropsWithChildren } from 'react'; | ||
import { CopyToClipboard } from 'react-copy-to-clipboard'; | ||
|
||
import { BASE_URL } from '~/constants/url'; | ||
|
||
interface Props { | ||
copyText: string; | ||
onCopy: () => void; | ||
} | ||
|
||
const CopyLink = ({ copyText, children, onCopy }: PropsWithChildren<Props>) => { | ||
return ( | ||
<CopyToClipboard text={copyToClipBoardWithHostUrl(copyText)} onCopy={onCopy}> | ||
{children} | ||
</CopyToClipboard> | ||
); | ||
}; | ||
|
||
export default CopyLink; | ||
|
||
const copyToClipBoardWithHostUrl = (path: string) => { | ||
if (typeof window === 'undefined') { | ||
return `${BASE_URL}${path}`; | ||
} else { | ||
const { host } = window.location; | ||
|
||
return `${host}${path}`; | ||
} | ||
}; |
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.