diff --git a/public/icon/twitter.svg b/public/icon/twitter.svg index c4081ad..5f77001 100644 --- a/public/icon/twitter.svg +++ b/public/icon/twitter.svg @@ -1 +1,15 @@ - \ No newline at end of file + + + + + + + + + + + + + + + diff --git a/src/components/button/TwitterShareButton.tsx b/src/components/button/TwitterShareButton.tsx index 432f2f0..daa49c0 100644 --- a/src/components/button/TwitterShareButton.tsx +++ b/src/components/button/TwitterShareButton.tsx @@ -6,8 +6,7 @@ const TwitterShareButton = ({ title }: { title: string }) => { href={`https://twitter.com/intent/tweet?text=${title}&url=${currentUrl}`} className="flex flex-col items-center gap-1" > - 트위터 아이콘 -

트위터

+ 트위터 아이콘 ); }; diff --git a/src/components/button/UrlCopyButton.tsx b/src/components/button/UrlCopyButton.tsx index f174e38..f5640f8 100644 --- a/src/components/button/UrlCopyButton.tsx +++ b/src/components/button/UrlCopyButton.tsx @@ -1,23 +1,36 @@ -const UrlCopyButton = ({currentUrl} : {currentUrl : string}) => { - const handleCopy = () => { - navigator.clipboard - .writeText(currentUrl) - .then(() => { - alert("URL이 복사되었습니다!"); // toast로 바꾸어야 함 -> 4.10 정준영 - }) - .catch((err) => { - console.error("URL 복사 실패:", err); - }); - }; - - return ( +import ToastMessage from "@/components/ToastMessage"; +import { useState } from "react"; + +const UrlCopyButton = ({ currentUrl }: { currentUrl: string }) => { + const [toastMessage, setToastMessage] = useState(""); + + const handleCopy = () => { + navigator.clipboard + .writeText(currentUrl) + .then(() => { + setToastMessage("URL을 복사했습니다."); + }) + .catch((err) => { + console.error("URL 복사 실패:", err); + }); + }; + + return ( + <> - ); - }; - - export default UrlCopyButton; \ No newline at end of file + {toastMessage && ( + setToastMessage("")} + /> + )} + + ); +}; + +export default UrlCopyButton;