File tree Expand file tree Collapse file tree 3 files changed +47
-21
lines changed
Expand file tree Collapse file tree 3 files changed +47
-21
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,7 @@ const TwitterShareButton = ({ title }: { title: string }) => {
66 href = { `https://twitter.com/intent/tweet?text=${ title } &url=${ currentUrl } ` }
77 className = "flex flex-col items-center gap-1"
88 >
9- < img src = "/icon/twitter.svg" alt = "트위터 아이콘" width = { 76 } height = { 76 } />
10- < p className = "text-md text-gray-800" > 트위터</ p >
9+ < img src = "/icon/twitter.svg" alt = "트위터 아이콘" width = { 72 } height = { 72 } />
1110 </ a >
1211 ) ;
1312} ;
Original file line number Diff line number Diff line change 1- const UrlCopyButton = ( { currentUrl} : { currentUrl : string } ) => {
2- const handleCopy = ( ) => {
3- navigator . clipboard
4- . writeText ( currentUrl )
5- . then ( ( ) => {
6- alert ( "URL이 복사되었습니다!" ) ; // toast로 바꾸어야 함 -> 4.10 정준영
7- } )
8- . catch ( ( err ) => {
9- console . error ( "URL 복사 실패:" , err ) ;
10- } ) ;
11- } ;
12-
13- return (
1+ import ToastMessage from "@/components/ToastMessage" ;
2+ import { useState } from "react" ;
3+
4+ const UrlCopyButton = ( { currentUrl } : { currentUrl : string } ) => {
5+ const [ toastMessage , setToastMessage ] = useState < string > ( "" ) ;
6+
7+ const handleCopy = ( ) => {
8+ navigator . clipboard
9+ . writeText ( currentUrl )
10+ . then ( ( ) => {
11+ setToastMessage ( "URL을 복사했습니다." ) ;
12+ } )
13+ . catch ( ( err ) => {
14+ console . error ( "URL 복사 실패:" , err ) ;
15+ } ) ;
16+ } ;
17+
18+ return (
19+ < >
1420 < button
1521 onClick = { handleCopy }
16- className = "bg-primary-normal h-8 text-white flex items-center justify-center rounded-[20px] px-4 py-2"
22+ className = "flex h-8 items-center justify-center rounded-[20px] bg-primary-normal px-4 py-2 text-white "
1723 >
1824 복사
1925 </ button >
20- ) ;
21- } ;
22-
23- export default UrlCopyButton ;
26+ { toastMessage && (
27+ < ToastMessage
28+ message = { toastMessage }
29+ onClose = { ( ) => setToastMessage ( "" ) }
30+ />
31+ ) }
32+ </ >
33+ ) ;
34+ } ;
35+
36+ export default UrlCopyButton ;
You can’t perform that action at this time.
0 commit comments