Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0f7a8aa
Update EmailShareButton.js
andrewl913 Nov 28, 2018
7bb0d21
Whatsapp button should check if mobile
madkoding Nov 29, 2018
0c721f7
Removed bits of dead code
aautio Dec 7, 2018
e4cc88f
Removed GooglePlusShareCount. Fixes #167.
aautio Dec 7, 2018
28fb721
Removed LinkedInShareCount. Fixes #178.
aautio Dec 7, 2018
f60d91c
Removed title and description from LinkedinShareButton. Fixes #184.
aautio Dec 7, 2018
d855165
`aria-label` for share buttons based on the network name. Fixes #155.
aautio Dec 7, 2018
a213550
Fully removing Google+ as all their APIs are shut down within 90 days…
aautio Dec 11, 2018
7bd843b
Email body is now optional. Separator can be chosen (defaults to ' ').
aautio Dec 11, 2018
e481aac
Viber shares no longer prepend space and expose the separator as a prop.
aautio Dec 11, 2018
955c90a
Simplified Whatsapp mobile/tablet check, styled to pass linting
aautio Dec 12, 2018
e345e47
Update README.md
finppp Dec 18, 2018
f6a3bcf
Merge pull request #193 from andrewl913/master
aautio Dec 19, 2018
d328f9e
Merge pull request #194 from madkoding/patch-1
aautio Dec 19, 2018
ee9cd2b
Merge pull request #197 from aautio/master
aautio Dec 19, 2018
9e4981e
Merge pull request #198 from aautio/viber
aautio Dec 19, 2018
1717beb
Merge branch 'v3' into googleplus
aautio Dec 19, 2018
5739e04
Merge pull request #199 from aautio/googleplus
aautio Dec 19, 2018
0609bbd
Merge branch 'v3' into patch-1
aautio Dec 19, 2018
5b54bac
Merge pull request #200 from finppp/patch-1
aautio Dec 19, 2018
fa524ed
add Pocket and Instagram share buttons and icons
jwrubel Dec 18, 2018
37d3e27
Updated documentation, screenshot, changelog and dependencies for v3
aautio Feb 3, 2019
073982f
add windowPosition prop for share buttons, refactor window position l…
nygardk Feb 10, 2019
e1594d9
default to "screenCenter" for windowPosition prop on WeiboShareButton
nygardk Feb 10, 2019
77a43b4
fix: remove image assertion from weiboLink
nygardk Feb 10, 2019
c52dc67
default to "screenCenter" for windowPosition prop on OKShareButton
aautio Feb 10, 2019
b1d5ea8
Merge pull request #212 from nygardk/fix/weiboLink-assert
aautio Feb 10, 2019
27baaeb
Merge branch 'master' of https://github.com/jwrubel/react-share into …
aautio Feb 16, 2019
22d35ac
Merge pull request #201 from jwrubel/master
aautio Feb 16, 2019
bff3cfb
Updated CHANGELOG.md to include PocketShareButton, InstapaperShareBut…
aautio Feb 16, 2019
4b99d33
Updated example.png to include Pocket and Instapaper icons.
aautio Feb 16, 2019
9565119
fix weibo image prop in demo
sinchang Mar 5, 2019
0ce8e0d
fix weibo share does not contain url
sinchang Mar 5, 2019
aeaf90f
Merge pull request #220 from sinchang-bot/patch-2
aautio Mar 20, 2019
5a4bf2f
Merge pull request #219 from sinchang-bot/patch-1
aautio Mar 20, 2019
f247d32
Updated changelog to include Weibo fixes from sinchang
aautio Mar 20, 2019
79367b0
Merge pull request #211 from nygardk/feat/windowPosition-prop
aautio Mar 20, 2019
cf6df3c
Updated changelog with info from #211 (screen centering for Weibo & OK)
aautio Mar 22, 2019
179d938
Allow rounded corners for rect icons
sergioribeiro Mar 23, 2019
ee0f562
Merge branch 'sergioribeiro-master' into v3
nygardk Mar 24, 2019
098b51a
dependency updates
nygardk Mar 23, 2019
b04895f
update docs
nygardk Mar 23, 2019
0ae2b4c
drop react 0.13 and 0.14 from peerDependencies
nygardk Mar 24, 2019
f57dec3
define library files explicitly in package.json
nygardk Mar 24, 2019
d9b8157
changelog update
nygardk Mar 23, 2019
31e25f3
version bump
nygardk Mar 23, 2019
3b428d4
prepublish script is depracated as of npm 5, use prepublishOnly
nygardk Mar 24, 2019
5e2dda3
upgrade react-hot-loader
nygardk Mar 24, 2019
383e9b5
fix lint script
nygardk Feb 10, 2019
ca63253
upgrade eslint to v5
nygardk Feb 10, 2019
622be29
remove build-demo from build script -> run build-demo separately when…
nygardk Mar 24, 2019
c23f0c5
add eslint-plugin-babel
nygardk Mar 24, 2019
670099c
add `borderRadius` icon prop in readme
nygardk May 15, 2019
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
4 changes: 2 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"with_react_hot_loader": {
"presets": ["env"],
"plugins": [
"react-hot-loader/babel",
"transform-runtime",
"transform-react-jsx",
"transform-class-properties",
"transform-object-rest-spread"
"transform-object-rest-spread",
"react-hot-loader/babel"
]
}
}
Expand Down
6 changes: 2 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
{
"extends": "airbnb",
"plugins": ["babel", "react"],
"extends": ["airbnb"],
"env": {
"es6": true,
"browser": true
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"react/jsx-closing-bracket-location": 0,
"react/jsx-first-prop-new-line": 0,
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 3.0.0 (March 24, 2019)

* Added `<PocketShareButton>`
* Added `<InstapaperShareButton>`
* Added `borderRadius` prop for icons
* A default `aria-label` is generated for the share buttons. It is based on the network name. Use `additionalProps` to override.
* Removed support for Google+.
* Removed support for `<LinkedInShareCount/>`. LinkedIn no longer provides an API to fetch share counts.
* Removed `title` and `description` from `<LinkedInShareButtons/>`.
* Fix: `<EmailShareButton/>` includes `body` before `url`.
* Fix: `<EmailShareButton/>` and `<ViberShareButton/>` allow customization of `separator`.
* Fix: `<WeiboShareButton/>` no longer requires `image` prop
* Fix: `<WeiboShareButton/>` includes url correctly when shared
* Fix: `<WeiboShareButton/>` and `<OKShareButton/>` open in screen center to prevent window from jumping after opening
* Thanks @finppp, @madkoding, @andrewl913, @jwrubel, @sinchang and @sergioribeiro!

## 2.4.0 (Nov 24, 2018)

* Added `<LineShareButton />` and `<WeiboShareButton />`
Expand Down
33 changes: 19 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

<img src="example.png" alt="Share buttons and counts example" />

Migrating from v2 to v3? Read [changelog](./CHANGELOG.md).

Migrating from v1 to v2? Read [migration notes](./migrate-v1-to-v2.md).

### Features
Expand All @@ -17,7 +19,6 @@ Migrating from v1 to v2? Read [migration notes](./migrate-v1-to-v2.md).
- Facebook
- Twitter
- Telegram
- Google+
- Whatsapp
- LinkedIn
- Pinterest
Expand All @@ -31,11 +32,11 @@ Migrating from v1 to v2? Read [migration notes](./migrate-v1-to-v2.md).
- Workplace
- Line
- Weibo
- Pocket
- Instapaper
- email
* share counts for
- Facebook
- Google+
- Linkedin
- Pinterest
- VK
- Odnoklassniki
Expand All @@ -61,23 +62,23 @@ npm install react-share --save

ShareButtons work on all browsers.

ShareCounts works on all browsers, with the exception of Google Plus share count
working only on IE11 and newer (XHR CORS problem).
ShareCounts works on all browsers.

## Compatibility

__Version 1.x.x__: compatible with React versions `0.13.x`, `0.14.x` and `15.x.x`.

__Version 2.x.x__: comptiblity is tested with React 15 and 16.

__Version 3.x.x__: comptiblity is tested with React 15 and 16.

## API

### Share buttons

```js
import {
FacebookShareButton,
GooglePlusShareButton,
LinkedinShareButton,
TwitterShareButton,
TelegramShareButton,
Expand All @@ -92,6 +93,8 @@ import {
ViberShareButton,
WorkplaceShareButton,
LineShareButton,
PocketShareButton,
InstapaperShareButton,
EmailShareButton,
} from 'react-share';
```
Expand All @@ -100,10 +103,9 @@ import {

| |Required props|Optional props|
|-------|--------|--------------|
|__All__|__`children`__: A React node (e.g. string or element)<br />__`url`__: URL of the shared page (string)|__`disabled`__: Disables click action and adds `disabled` class (bool)<br/>__`disabledStyle`__: Style when button is disabled (object, default = { opacity: 0.6 })<br/>__`windowWidth`, `windowHeight`__: opened window dimensions (int, different defaults for all share buttons)<br>__`beforeOnClick`__: Takes a function that returns a Promise to be fulfilled before calling `onClick`. If you do not return promise, `onClick` is called immediately.<br>__`onShareWindowClose`__: Takes a function to be called after closing share dialog.<br>__`additionalProps`__: An object to pass any additional properties, such as `aria-*` attributes.|
|__All__|__`children`__: A React node (e.g. string or element)<br />__`url`__: URL of the shared page (string)|__`disabled`__: Disables click action and adds `disabled` class (bool)<br/>__`disabledStyle`__: Style when button is disabled (object, default = { opacity: 0.6 })<br/>__`windowWidth`, `windowHeight`__: opened window dimensions (int, different defaults for all share buttons)<br>__`beforeOnClick`__: Takes a function that returns a Promise to be fulfilled before calling `onClick`. If you do not return promise, `onClick` is called immediately.<br>__`onShareWindowClose`__: Takes a function to be called after closing share dialog.<br>__`additionalProps`__: An object to pass any additional properties, such as `aria-*` attributes. Provides an override possibility for the default `aria-label`.|
|FacebookShareButton|-|__`quote`__: A quote to be shared along with the link. (string)<br/>__`hashtag`__: A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol. (string)|
|GooglePlusShareButton|-|-|
|LinkedinShareButton|-|__`title`__: Title of the shared page (string)<br/>__`description`__: Description of the shared page (string)|
|LinkedinShareButton|-|-|
|TwitterShareButton|-|__`title`__: Title of the shared page (string)<br/>__`via`__: (string)<br/>__`hashtags`__: (array)|
|TelegramShareButton|-|__`title`__: Title of the shared page (string)<br/>|
|WhatsappShareButton|-|__`title`__: Title of the shared page (string)<br/>__`separator`__: Separates title from the url, default: " " (string)|
Expand All @@ -114,19 +116,19 @@ import {
|TumblrShareButton|-|__`title`__: Title of the shared page (string)<br/>__`tags`__: (array)<br/>__`caption`__: Description of the shared page (string)|
|LivejournalShareButton|-|__`title`__: Title of the shared page (string)<br/>__`description`__: Description of the shared page (string)|
|MailruShareButton|-|__`title`__: Title of the shared page (string)<br/>__`description`__: Description of the shared page (string)<br/>__`image`__: An absolute link to the image that will be shared (string)|
|ViberShareButton|-|__`title`__: Title of the shared page (string)<br/>|
|ViberShareButton|-|__`title`__: Title of the shared page (string)<br/>__`separator`__: Separates title from the url, default: " " (string)|
|WorkplaceShareButton|-|__`quote`__: A quote to be shared along with the link. (string)<br/>__`hashtag`__: A hashtag specified by the developer to be added to the shared content. People will still have the opportunity to remove this hashtag in the dialog. The hashtag should include the hash symbol. (string)|
|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), defaults to shared url.|
|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

```js
import {
FacebookShareCount,
GooglePlusShareCount,
LinkedinShareCount,
PinterestShareCount,
VKShareCount,
OKShareCount,
Expand Down Expand Up @@ -164,7 +166,6 @@ import {
TwitterIcon,
TelegramIcon,
WhatsappIcon,
GooglePlusIcon,
LinkedinIcon,
PinterestIcon,
VKIcon,
Expand All @@ -176,6 +177,8 @@ import {
ViberIcon,
WorkplaceIcon,
LineIcon,
PocketIcon,
InstapaperIcon,
EmailIcon,
} from 'react-share';
```
Expand All @@ -186,6 +189,8 @@ Props:

* `round`: Whether to show round or rect icons (bool)

* `borderRadius`: Allow rounded corners if using rect icons (number)

* `iconBgStyle`: customize background style, e.g. `fill` (object)

* `logoFillColor`: customize logo's fill color (string, default = 'white')
Expand Down
58 changes: 27 additions & 31 deletions demo/Demo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
import React, { Component } from 'react';
import {
FacebookShareCount,
GooglePlusShareCount,
LinkedinShareCount,
PinterestShareCount,
VKShareCount,
OKShareCount,
RedditShareCount,
TumblrShareCount,

FacebookShareButton,
GooglePlusShareButton,
LinkedinShareButton,
TwitterShareButton,
PinterestShareButton,
Expand All @@ -29,10 +26,11 @@ import {
WorkplaceShareButton,
LineShareButton,
WeiboShareButton,
PocketShareButton,
InstapaperShareButton,

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

import './Demo.css';
Expand Down Expand Up @@ -118,39 +118,16 @@ class Demo extends Component {
</div>
</div>

<div className="Demo__some-network">
<GooglePlusShareButton
url={shareUrl}
className="Demo__some-network__share-button">
<GooglePlusIcon
size={32}
round />
</GooglePlusShareButton>

<GooglePlusShareCount
url={shareUrl}
className="Demo__some-network__share-count">
{count => count}
</GooglePlusShareCount>
</div>

<div className="Demo__some-network">
<LinkedinShareButton
url={shareUrl}
title={title}
windowWidth={750}
windowHeight={600}
className="Demo__some-network__share-button">
<LinkedinIcon
size={32}
round />
</LinkedinShareButton>

<LinkedinShareCount
url={shareUrl}
className="Demo__some-network__share-count">
{count => count}
</LinkedinShareCount>
</div>

<div className="Demo__some-network">
Expand Down Expand Up @@ -187,8 +164,6 @@ class Demo extends Component {
<OKShareButton
url={shareUrl}
image={`${String(window.location)}/${exampleImage}`}
windowWidth={660}
windowHeight={460}
className="Demo__some-network__share-button">
<OKIcon
size={32}
Expand Down Expand Up @@ -268,7 +243,6 @@ class Demo extends Component {
<ViberShareButton
url={shareUrl}
title={title}
body="body"
className="Demo__some-network__share-button">
<ViberIcon
size={32}
Expand Down Expand Up @@ -302,11 +276,33 @@ class Demo extends Component {
<WeiboShareButton
url={shareUrl}
title={title}
pic={`${String(window.location)}/${exampleImage}`}
image={`${String(window.location)}/${exampleImage}`}
className="Demo__some-network__share-button">
<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
9 changes: 9 additions & 0 deletions demo/Root.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import { hot } from 'react-hot-loader/root';

import Demo from './Demo';

const Root = () => <Demo />;

export default hot(Root);
8 changes: 2 additions & 6 deletions demo/index.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import ReactDOM from 'react-dom';
import Demo from './Demo';
import Root from './Root';

const rootElement = document.createElement('div');

if (!document.querySelector('div')) {
document.body.appendChild(rootElement);
}

ReactDOM.render(<Demo />, rootElement);

if (module.hot) {
module.hot.accept();
}
ReactDOM.render(<Root />, rootElement);
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.031dcc7181405ee17c67.bundle.js"></script></body>
<script type="text/javascript" src="main.dc127c7d6e56dd77f814.bundle.js"></script></body>
</html>
Loading