Skip to content

Commit 65d8ba3

Browse files
authored
Modify ShareButtons for updated Twitter URL
Updated Twitter sharing URL to use 'x.com' and added conditional text parameter.
1 parent b251324 commit 65d8ba3

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

components/ShareButtons.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,25 @@ interface ShareButtonsProps {
77

88
export default function ShareButtons({ url, title = '' }: ShareButtonsProps) {
99
const linkedinUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`;
10-
const twitterUrl = `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(title)}`;
10+
const twitterUrl = `https://x.com/intent/tweet?url=${encodeURIComponent(url)}` +
11+
(title ? `&text=${encodeURIComponent(title)}` : '');
1112

1213
return (
1314
<div className="flex gap-3">
14-
<a href={linkedinUrl} target="_blank" rel="noopener noreferrer">
15+
<a
16+
href={linkedinUrl}
17+
target="_blank"
18+
rel="noopener noreferrer"
19+
aria-label="Share on LinkedIn (opens in a new tab)"
20+
>
1521
<FaLinkedin size={24} />
1622
</a>
17-
<a href={twitterUrl} target="_blank" rel="noopener noreferrer">
23+
<a
24+
href={twitterUrl}
25+
target="_blank"
26+
rel="noopener noreferrer"
27+
aria-label="Share on X / Twitter (opens in a new tab)"
28+
>
1829
<FaXTwitter size={24} />
1930
</a>
2031
</div>

0 commit comments

Comments
 (0)