Skip to content

Commit

Permalink
add GabShareButton and GabIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
nygardk committed Nov 18, 2023
1 parent f3f7c18 commit 2c0ab57
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-chicken-train.md
@@ -0,0 +1,5 @@
---
"react-share": minor
---

Added `GabShareButton` and `GabIcon` to share on [gab.com](https://gab.com). Originally implemented [here](https://github.com/nygardk/react-share/pull/425).
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -32,6 +32,7 @@
- Pocket
- Instapaper
- Hatena
- Gab
- email
- share counts for
- Facebook
Expand Down Expand Up @@ -76,6 +77,7 @@ npm install react-share
import {
EmailShareButton,
FacebookShareButton,
GabShareButton,
HatenaShareButton,
InstapaperShareButton,
LineShareButton,
Expand Down Expand Up @@ -163,6 +165,7 @@ import {
EmailIcon,
FacebookIcon,
FacebookMessengerIcon,
GabIcon,
HatenaIcon,
InstapaperIcon,
LineIcon,
Expand Down
14 changes: 14 additions & 0 deletions demo/Demo.tsx
Expand Up @@ -9,6 +9,8 @@ import {
FacebookMessengerShareButton,
FacebookShareButton,
FacebookShareCount,
GabIcon,
GabShareButton,
HatenaIcon,
HatenaShareButton,
HatenaShareCount,
Expand Down Expand Up @@ -180,6 +182,18 @@ class Demo extends Component {
</div>
</div>

<div className="Demo__some-network">
<GabShareButton
url={shareUrl}
title={title}
windowWidth={660}
windowHeight={640}
className="Demo__some-network__share-button"
>
<GabIcon size={32} round />
</GabShareButton>
</div>

<div className="Demo__some-network">
<TumblrShareButton
url={shareUrl}
Expand Down
Binary file modified example.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/GabIcon.ts
@@ -0,0 +1,9 @@
import createIcon from './hocs/createIcon';

const GabIcon = createIcon({
color: '#00d178',
networkName: 'gab',
path: 'm17.0506,23.97457l5.18518,0l0,14.23933c0,6.82699 -3.72695,10.09328 -9.33471,10.09328c-2.55969,0 -4.82842,-0.87286 -6.22084,-2.0713l2.07477,-3.88283c1.19844,0.81051 2.33108,1.29543 3.85511,1.29543c2.75366,0 4.44049,-1.97432 4.44049,-4.82149l0,-0.87286c-1.16728,1.39242 -2.81947,2.0713 -4.63446,2.0713c-4.44048,0 -7.81068,-3.68885 -7.81068,-8.28521c0,-4.59289 3.37019,-8.28174 7.81068,-8.28174c1.81499,0 3.46718,0.67888 4.63446,2.0713l0,-1.55521zm-3.62997,11.39217c1.97777,0 3.62997,-1.6522 3.62997,-3.62652c0,-1.97432 -1.6522,-3.62305 -3.62997,-3.62305c-1.97778,0 -3.62997,1.64873 -3.62997,3.62305c0,1.97432 1.65219,3.62652 3.62997,3.62652zm25.7077,4.13913l-5.18518,0l0,-1.29197c-1.00448,1.13264 -2.3969,1.81152 -4.21188,1.81152c-3.62997,0 -5.63893,-2.52504 -5.63893,-5.4034c0,-4.27076 5.251,-5.85715 9.78846,-4.49937c-0.09698,-1.39241 -0.9733,-2.39343 -2.78829,-2.39343c-1.26426,0 -2.72248,0.48492 -3.62997,1.00102l-1.5552,-3.72003c1.19844,-0.77587 3.40136,-1.55174 5.96452,-1.55174c3.78931,0 7.25648,2.13365 7.25648,7.95962l0,8.08777zm-5.18518,-6.14809c-2.42806,-0.77587 -4.66563,-0.3533 -4.66563,1.36124c0,1.00101 0.84168,1.6799 1.84616,1.6799c1.20191,0 2.56315,-0.96984 2.81947,-3.04115zm13.00626,-17.66495l0,9.83695c1.16727,-1.39242 2.81946,-2.0713 4.63445,-2.0713c4.44048,0 7.81068,3.68885 7.81068,8.28174c0,4.59636 -3.37019,8.28521 -7.81068,8.28521c-1.81499,0 -3.46718,-0.67888 -4.63445,-2.0713l0,1.55174l-5.18519,0l0,-23.81304l5.18519,0zm3.62997,19.67391c1.97777,0 3.62997,-1.6522 3.62997,-3.62652c0,-1.97432 -1.6522,-3.62305 -3.62997,-3.62305c-1.97778,0 -3.62997,1.64873 -3.62997,3.62305c0,1.97432 1.65219,3.62652 3.62997,3.62652zm0,0',
});

export default GabIcon;
30 changes: 30 additions & 0 deletions src/GabShareButton.ts
@@ -0,0 +1,30 @@
import assert from './utils/assert';
import objectToGetParams from './utils/objectToGetParams';
import createShareButton from './hocs/createShareButton';

function gabLink(url: string, { title }: { title?: string }) {
assert(url, 'gab.url');

return (
'https://gab.com/compose' +
objectToGetParams({
url,
text: title,
})
);
}

const GabShareButton = createShareButton<{ title?: string }>(
'gab',
gabLink,
props => ({
title: props.title,
}),
{
windowWidth: 660,
windowHeight: 640,
windowPosition: 'windowCenter',
},
);

export default GabShareButton;
2 changes: 2 additions & 0 deletions src/index.ts
Expand Up @@ -28,6 +28,8 @@ export { default as PocketIcon } from './PocketIcon';
export { default as PocketShareButton } from './PocketShareButton';
export { default as RedditIcon } from './RedditIcon';
export { default as RedditShareButton } from './RedditShareButton';
export { default as GabShareButton } from './GabShareButton';
export { default as GabIcon } from './GabIcon';
export { default as RedditShareCount } from './RedditShareCount';
export { default as TelegramIcon } from './TelegramIcon';
export { default as TelegramShareButton } from './TelegramShareButton';
Expand Down

0 comments on commit 2c0ab57

Please sign in to comment.