Skip to content

Commit aae623c

Browse files
committed
feat: twitter svg 디자인 시안으로 변경, alert -> Toast로 대체
1 parent aa13b4e commit aae623c

File tree

3 files changed

+47
-21
lines changed

3 files changed

+47
-21
lines changed

public/icon/twitter.svg

Lines changed: 15 additions & 1 deletion
Loading

src/components/button/TwitterShareButton.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff 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
};
Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
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;

0 commit comments

Comments
 (0)