Skip to content

Commit

Permalink
✨ Tweet with title.
Browse files Browse the repository at this point in the history
  • Loading branch information
92thunder committed Feb 11, 2024
1 parent a595039 commit 227d848
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
8 changes: 6 additions & 2 deletions components/ShareButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ import {
TwitterShareButton,
} from "react-share"

export const ShareButtons: FC = () => {
export const ShareButtons: FC<{ title: string }> = ({ title }) => {
const baseUrl = "https://92thunder.dev"
const router = useRouter()
const currentURL = baseUrl + router.asPath

return (
<HStack gap={4} mt={8}>
<TwitterShareButton style={{ width: "min-content" }} url={currentURL}>
<TwitterShareButton
style={{ width: "min-content" }}
url={currentURL}
title={title}
>
<TwitterIcon round size={32} />
</TwitterShareButton>
<HatenaShareButton style={{ width: "min-content" }} url={currentURL}>
Expand Down
22 changes: 9 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "7.1.2",
"react-share": "^4.4.1",
"react-share": "^5.1.0",
"react-syntax-highlighter": "^15.4.5",
"remark-gfm": "^3.0.1"
},
Expand Down
2 changes: 1 addition & 1 deletion pages/blog/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const PostPage: NextPage = ({
{post.body}
</ReactMarkdown>
<Box mt={20}>
<ShareButtons />
<ShareButtons title={post.title} />
</Box>
</Box>
</HStack>
Expand Down

0 comments on commit 227d848

Please sign in to comment.