Skip to content

Commit 142b59c

Browse files
Puneethtejaudaycodespace
authored andcommitted
Refactor ShareButtons component for better readability
1 parent 4038923 commit 142b59c

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

components/ShareButtons.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ interface ShareButtonsProps {
55
title?: string;
66
}
77

8-
export default function ShareButtons({ url, title = '' }: ShareButtonsProps) {
9-
const linkedinUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`;
10-
const twitterUrl = `https://x.com/intent/tweet?url=${encodeURIComponent(url)}` +
8+
export default function ShareButtons({
9+
url,
10+
title = '',
11+
}: ShareButtonsProps) {
12+
const linkedinUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(
13+
url
14+
)}`;
15+
const twitterUrl =
16+
`https://x.com/intent/tweet?url=${encodeURIComponent(url)}` +
1117
(title ? `&text=${encodeURIComponent(title)}` : '');
1218

1319
return (
@@ -20,7 +26,6 @@ export default function ShareButtons({ url, title = '' }: ShareButtonsProps) {
2026
>
2127
<FaLinkedin size={24} aria-hidden="true" />
2228
</a>
23-
2429
<a
2530
href={twitterUrl}
2631
target="_blank"

0 commit comments

Comments
 (0)