Skip to content

Commit 373add6

Browse files
cwlowdernygardk
authored andcommitted
add Social Share Button and Icon for Bluesky
1 parent 151363d commit 373add6

File tree

7 files changed

+62
-0
lines changed

7 files changed

+62
-0
lines changed

.changeset/many-squids-promise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-share": minor
3+
---
4+
5+
Added `BlueskyShareButton` and `BlueskyIcon`. This button will take a title and url parameter, and then use [Bluesky Intent Links](https://docs.bsky.app/docs/advanced-guides/intent-links) to share that content. There is also an overrideable seperator parameter (defaults as ' ') that seperates the title and url.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ npm install react-share
3939
- Instapaper
4040
- Hatena
4141
- Gab
42+
- Bluesky
4243
- email
4344
- Threads
4445
- share counts for
@@ -190,6 +191,7 @@ import {
190191
WhatsappIcon,
191192
WorkplaceIcon,
192193
XIcon,
194+
BlueskyIcon,
193195
} from "react-share";
194196
```
195197

demo/Demo.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
22
import {
3+
BlueskyIcon,
4+
BlueskyShareButton,
35
EmailIcon,
46
EmailShareButton,
57
FacebookIcon,
@@ -317,6 +319,18 @@ export function Demo() {
317319
<ThreadsIcon size={32} round />
318320
</ThreadsShareButton>
319321
</div>
322+
323+
<div className="Demo__some-network">
324+
<BlueskyShareButton
325+
url={shareUrl}
326+
title={title}
327+
windowWidth={660}
328+
windowHeight={460}
329+
className="Demo__some-network__share-button"
330+
>
331+
<BlueskyIcon size={32} round />
332+
</BlueskyShareButton>
333+
</div>
320334
</div>
321335
);
322336
}

example.png

2.76 KB
Loading

src/BlueskyIcon.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import createIcon from './hocs/createIcon';
2+
3+
const BlueskyIcon = createIcon({
4+
color: '#1185FE',
5+
networkName: 'bluesky',
6+
path: 'M21.945 18.886C26.015 21.941 30.393 28.137 32 31.461 33.607 28.137 37.985 21.941 42.055 18.886 44.992 16.681 49.75 14.975 49.75 20.403 49.75 21.487 49.128 29.51 48.764 30.813 47.497 35.341 42.879 36.496 38.772 35.797 45.951 37.019 47.778 41.067 43.833 45.114 36.342 52.801 33.066 43.186 32.227 40.722 32.073 40.27 32.001 40.059 32 40.238 31.999 40.059 31.927 40.27 31.773 40.722 30.934 43.186 27.658 52.801 20.167 45.114 16.222 41.067 18.049 37.019 25.228 35.797 21.121 36.496 16.503 35.341 15.236 30.813 14.872 29.51 14.25 21.487 14.25 20.403 14.25 14.975 19.008 16.681 21.945 18.886Z',
7+
});
8+
9+
export default BlueskyIcon;

src/BlueskyShareButton.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import assert from './utils/assert';
2+
import objectToGetParams from './utils/objectToGetParams';
3+
import createShareButton from './hocs/createShareButton';
4+
5+
function blueskyLink(url: string, { title, separator }: { title?: string; separator?: string }) {
6+
assert(url, 'bluesky.url');
7+
8+
return (
9+
'https://bsky.app/intent/compose' +
10+
objectToGetParams({
11+
text: title ? title + separator + url : url,
12+
})
13+
);
14+
}
15+
16+
const BlueskyShareButton = createShareButton<{ title?: string; separator?: string }>(
17+
'bluesky',
18+
blueskyLink,
19+
props => ({
20+
title: props.title,
21+
separator: props.separator || ' ',
22+
}),
23+
{
24+
windowWidth: 660,
25+
windowHeight: 460,
26+
windowPosition: 'windowCenter',
27+
},
28+
);
29+
30+
export default BlueskyShareButton;

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export { default as BlueskyIcon } from './BlueskyIcon';
2+
export { default as BlueskyShareButton } from './BlueskyShareButton';
13
export { default as EmailIcon } from './EmailIcon';
24
export { default as EmailShareButton } from './EmailShareButton';
35
export { default as FacebookIcon } from './FacebookIcon';

0 commit comments

Comments
 (0)