Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Migrating from v1 to v2? Read [migration notes](./migrate-v1-to-v2.md).
- Workplace
- Line
- Weibo
- Pocket
- Instapaper
- email
* share counts for
- Facebook
Expand Down Expand Up @@ -91,6 +93,8 @@ import {
ViberShareButton,
WorkplaceShareButton,
LineShareButton,
PocketShareButton,
InstapaperShareButton,
EmailShareButton,
} from 'react-share';
```
Expand All @@ -117,6 +121,8 @@ import {
|LineShareButton|-|__`title`__: Title of the shared page (string)|
|WeiboShareButton|-|__`title`__: Title of the shared page (string)<br/>__`image`__: An absolute link to the image that will be shared (string)|
|EmailShareButton|-|__`subject`__: Title of the shared page (string)<br/>__`body`__: Body of the email (string), will be prepended to the url.<br/>__`separator`__: Separates body from the url, default: " " (string)<br/>__`openWindow`__: Opens the mail client in a new window. Defaults to false (bool)|
|PocketShareButton|-|__`title`__: Title of the shared page (string). Note that if Pocket detects a title tag on the page being saved, this parameter will be ignored and the title tag of the saved page will be used instead.|
|InstapaperShareButton|-|__`title`__: Title of the shared page (string)<br/>__`description`__: Description of the shared page (string)|

### Share counts

Expand Down Expand Up @@ -171,6 +177,8 @@ import {
ViberIcon,
WorkplaceIcon,
LineIcon,
PocketIcon,
InstapaperIcon,
EmailIcon,
} from 'react-share';
```
Expand Down
26 changes: 26 additions & 0 deletions demo/Demo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
WorkplaceShareButton,
LineShareButton,
WeiboShareButton,
PocketShareButton,
InstapaperShareButton,

FacebookIcon,
TwitterIcon,
Expand All @@ -43,6 +45,8 @@ import {
ViberIcon,
WorkplaceIcon,
LineIcon,
PocketIcon,
InstapaperIcon,
} from 'react-share';

import './Demo.css';
Expand Down Expand Up @@ -279,6 +283,28 @@ class Demo extends Component {
<img className="Demo__some-network__custom-icon" src="http://icons.iconarchive.com/icons/martz90/circle-addon2/512/weibo-icon.png" alt="Weibo share button" />
</WeiboShareButton>
</div>

<div className="Demo__some-network">
<PocketShareButton
url={shareUrl}
title={title}
className="Demo__some-network__share-button">
<PocketIcon
size={32}
round />
</PocketShareButton>
</div>

<div className="Demo__some-network">
<InstapaperShareButton
url={shareUrl}
title={title}
className="Demo__some-network__share-button">
<InstapaperIcon
size={32}
round />
</InstapaperShareButton>
</div>
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
<title>react-share demo | Social media share buttons and share counts for React.</title>
</head>
<body>
<script type="text/javascript" src="main.51069f68eb45405d116c.bundle.js"></script></body>
<script type="text/javascript" src="main.bb5e03d2eeb9771e6839.bundle.js"></script></body>
</html>

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/InstapaperIcon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import iconFactory from './utils/iconFactory';

const InstapaperIcon = iconFactory('instapaper', {
icon: 'M35.688 43.012c0 2.425.361 2.785 3.912 3.056V48H24.401v-1.932c3.555-.27 3.912-.63 3.912-3.056V20.944c0-2.379-.36-2.785-3.912-3.056V16H39.6v1.888c-3.55.27-3.912.675-3.912 3.056v22.068h.001z',
mask: 'M0,0v64h64V0H0z M35.688 43.012c0 2.425.361 2.785 3.912 3.056V48H24.401v-1.932c3.555-.27 3.912-.63 3.912-3.056V20.944c0-2.379-.36-2.785-3.912-3.056V16H39.6v1.888c-3.55.27-3.912.675-3.912 3.056v22.068h.001z',
color: '#1F1F1F',
});

export default InstapaperIcon;
29 changes: 29 additions & 0 deletions src/InstapaperShareButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import PropTypes from 'prop-types';

import assert from 'assert';

import createShareButton from './utils/createShareButton';
import objectToGetParams from './utils/objectToGetParams';

function instapaperLink(url, { title, description }) {
assert(url, 'instapaper.url');

return 'http://www.instapaper.com/hello2' + objectToGetParams({
url,
title,
description,
});
}

const InstapaperShareButton = createShareButton('instapaper', instapaperLink, props => ({
title: props.title,
description: props.description,
}), {
title: PropTypes.string,
description: PropTypes.string,
}, {
windowWidth: 500,
windowHeight: 500,
});

export default InstapaperShareButton;
9 changes: 9 additions & 0 deletions src/PocketIcon.js

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

26 changes: 26 additions & 0 deletions src/PocketShareButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import PropTypes from 'prop-types';

import assert from 'assert';

import createShareButton from './utils/createShareButton';
import objectToGetParams from './utils/objectToGetParams';

function pocketLink(url, { title }) {
assert(url, 'pocket.url');

return 'https://getpocket.com/save' + objectToGetParams({
url,
title,
});
}

const PocketShareButton = createShareButton('pocket', pocketLink, props => ({
title: props.title,
}), {
title: PropTypes.string,
}, {
windowWidth: 500,
windowHeight: 500,
});

export default PocketShareButton;
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export { default as ViberShareButton } from './ViberShareButton';
export { default as WorkplaceShareButton } from './WorkplaceShareButton';
export { default as LineShareButton } from './LineShareButton';
export { default as WeiboShareButton } from './WeiboShareButton';
export { default as PocketShareButton } from './PocketShareButton';
export { default as InstapaperShareButton } from './InstapaperShareButton';

export { default as FacebookIcon } from './FacebookIcon';
export { default as TwitterIcon } from './TwitterIcon';
Expand All @@ -39,3 +41,5 @@ export { default as LivejournalIcon } from './LivejournalIcon';
export { default as ViberIcon } from './ViberIcon';
export { default as WorkplaceIcon } from './WorkplaceIcon';
export { default as LineIcon } from './LineIcon';
export { default as PocketIcon } from './PocketIcon';
export { default as InstapaperIcon } from './InstapaperIcon';