Skip to content

Commit 4038923

Browse files
Puneethtejaudaycodespace
authored andcommitted
Modify ShareButtons for updated Twitter URL
Updated Twitter sharing URL to use 'x.com' and added conditional text parameter.
1 parent 3c38075 commit 4038923

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

components/ShareButtons.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@ 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">
1415
<a
1516
href={linkedinUrl}
1617
target="_blank"
1718
rel="noopener noreferrer"
18-
aria-label="Share on LinkedIn"
19+
aria-label="Share on LinkedIn (opens in a new tab)"
1920
>
2021
<FaLinkedin size={24} aria-hidden="true" />
2122
</a>
2223

23-
<a href={twitterUrl} target="_blank" rel="noopener noreferrer" aria-label="Share on X">
24+
<a
25+
href={twitterUrl}
26+
target="_blank"
27+
rel="noopener noreferrer"
28+
aria-label="Share on X / Twitter (opens in a new tab)"
29+
>
2430
<FaXTwitter size={24} aria-hidden="true" />
2531
</a>
2632
</div>

0 commit comments

Comments
 (0)