Skip to content

Commit 99bbe1a

Browse files
update share
1 parent 9a6d518 commit 99bbe1a

File tree

6 files changed

+88
-1
lines changed

6 files changed

+88
-1
lines changed

package-lock.json

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"react": "^19.0.0",
1717
"react-dom": "^19.0.0",
1818
"react-scripts": "^5.0.1",
19+
"react-share": "^5.2.2",
1920
"vite": "^5.1.4",
2021
"youtube-dl-exec": "^3.0.16",
2122
"youtube-transcript": "^1.2.1",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.share-buttons {
2+
display: inline-flex;
3+
align-items: center;
4+
margin-left: 10px;
5+
}
6+
7+
.share-buttons button {
8+
cursor: pointer;
9+
transition: transform 0.2s ease;
10+
}
11+
12+
.share-buttons button:hover {
13+
transform: scale(1.1);
14+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import { LinkedinShareButton, LinkedinIcon } from 'react-share';
3+
4+
type ShareButtonsProps = {
5+
title: string;
6+
url: string;
7+
};
8+
9+
const ShareButtons: React.FC<ShareButtonsProps> = ({ title, url }) => {
10+
return (
11+
<div className="share-buttons">
12+
<LinkedinShareButton url={url} title={title}>
13+
<LinkedinIcon size={32} round />
14+
</LinkedinShareButton>
15+
</div>
16+
);
17+
};
18+
19+
export default ShareButtons;

src/components/talk/TalkContent.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import Spinner from "../Spinner";
55
import ErrorMessage from "../ErrorMessage";
66
import { marked } from "marked";
77
import TextToSpeech from "../TextToSpeech";
8+
import ShareButtons from "../share/ShareButtons";
9+
import "../share/ShareButtons.css";
810

911
type TalkContentProps = {
1012
talk: TTalk;
@@ -49,7 +51,13 @@ export function TalkContent({ talk }: TalkContentProps) {
4951
return (
5052
<div className="talk-content">
5153
<header className="talk-content__header">
52-
<h1 className="talk-content__title">{talk.title}</h1>
54+
<div className="talk-content__title-container">
55+
<h1 className="talk-content__title">{talk.title}</h1>
56+
<ShareButtons
57+
title={talk.title}
58+
url={window.location.href}
59+
/>
60+
</div>
5361
<div className="talk-content__category">{talk.category}</div>
5462
{content && <TextToSpeech text={plainTextContent} />}
5563
</header>

src/main.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,12 @@ ul li::before {
781781
border-bottom: 2px dashed var(--cozy-light-brown);
782782
}
783783

784+
.talk-content__title-container {
785+
display: flex;
786+
align-items: center;
787+
margin-bottom: 0.5rem;
788+
}
789+
784790
.talk-content__title {
785791
margin: 0 0 10px 0;
786792
font-size: 2rem;

0 commit comments

Comments
 (0)