react-share
Advanced tools
Comparing version 1.13.3 to 1.14.0
@@ -0,1 +1,6 @@ | ||
## 1.14.0 (Jun 4, 2017) | ||
* Added Reddit share button and count (thanks @watbe!). | ||
* `beforeOnClick` no longer has to return Promise | ||
## 1.13.3 (May 29, 2017) | ||
@@ -2,0 +7,0 @@ |
@@ -47,3 +47,3 @@ 'use strict'; | ||
var classes = 'social-icon social-icon--' + network + ' ' + (className || ''); | ||
var classes = 'social-icon social-icon--' + network + ' ' + className; | ||
@@ -95,2 +95,3 @@ var finalIconBgStyle = (0, _extends3.default)({}, iconBgStyle); | ||
Icon.defaultProps = { | ||
className: '', | ||
logoFillColor: 'white', | ||
@@ -97,0 +98,0 @@ size: 64 |
@@ -52,4 +52,8 @@ 'use strict'; | ||
color: '#2cb742' | ||
}, | ||
reddit: { | ||
icon: 'm 52.8165,31.942362 c 0,-2.4803 -2.0264,-4.4965 -4.5169,-4.4965 -1.2155,0 -2.3171,0.4862 -3.128,1.2682 -3.077,-2.0247 -7.2403,-3.3133 -11.8507,-3.4782 l 2.5211,-7.9373 6.8272,1.5997 -0.0102,0.0986 c 0,2.0281 1.6575,3.6771 3.6958,3.6771 2.0366,0 3.6924,-1.649 3.6924,-3.6771 0,-2.0281 -1.6575,-3.6788 -3.6924,-3.6788 -1.564,0 -2.8968,0.9758 -3.4357,2.3443 l -7.3593,-1.7255 c -0.3213,-0.0782 -0.6477,0.1071 -0.748,0.4233 L 32,25.212062 c -4.8246,0.0578 -9.1953,1.3566 -12.41,3.4425 -0.8058,-0.7446 -1.8751,-1.2104 -3.0583,-1.2104 -2.4905,0 -4.5152,2.0179 -4.5152,4.4982 0,1.649 0.9061,3.0787 2.2389,3.8607 -0.0884,0.4794 -0.1462,0.9639 -0.1462,1.4569 0,6.6487 8.1736,12.0581 18.2223,12.0581 10.0487,0 18.224,-5.4094 18.224,-12.0581 0,-0.4658 -0.0493,-0.9248 -0.1275,-1.377 1.4144,-0.7599 2.3885,-2.2304 2.3885,-3.9406 z m -29.2808,3.0872 c 0,-1.4756 1.207,-2.6775 2.6894,-2.6775 1.4824,0 2.6877,1.2019 2.6877,2.6775 0,1.4756 -1.2053,2.6758 -2.6877,2.6758 -1.4824,0 -2.6894,-1.2002 -2.6894,-2.6758 z m 15.4037,7.9373 c -1.3549,1.3481 -3.4816,2.0043 -6.5008,2.0043 l -0.0221,-0.0051 -0.0221,0.0051 c -3.0209,0 -5.1476,-0.6562 -6.5008,-2.0043 -0.2465,-0.2448 -0.2465,-0.6443 0,-0.8891 0.2465,-0.2465 0.6477,-0.2465 0.8942,0 1.105,1.0999 2.9393,1.6337 5.6066,1.6337 l 0.0221,0.0051 0.0221,-0.0051 c 2.6673,0 4.5016,-0.5355 5.6066,-1.6354 0.2465,-0.2465 0.6477,-0.2448 0.8942,0 0.2465,0.2465 0.2465,0.6443 0,0.8908 z m -0.3213,-5.2615 c -1.4824,0 -2.6877,-1.2002 -2.6877,-2.6758 0,-1.4756 1.2053,-2.6775 2.6877,-2.6775 1.4824,0 2.6877,1.2019 2.6877,2.6775 0,1.4756 -1.2053,2.6758 -2.6877,2.6758 z', | ||
color: '#5f99cf' | ||
} | ||
}; | ||
/* eslint-enable max-len */ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.ShareCounts = exports.ShareButtons = exports.generateShareIcon = undefined; | ||
exports.shareLinks = exports.ShareCounts = exports.ShareButtons = exports.generateShareIcon = undefined; | ||
@@ -19,2 +19,6 @@ var _generateIcon = require('./generateIcon'); | ||
var _socialMediaShareLinks = require('./social-media-share-links'); | ||
var shareLinks = _interopRequireWildcard(_socialMediaShareLinks); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -24,2 +28,3 @@ | ||
exports.ShareButtons = ShareButtons; | ||
exports.ShareCounts = ShareCounts; | ||
exports.ShareCounts = ShareCounts; | ||
exports.shareLinks = shareLinks; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.OKShareButton = exports.VKShareButton = exports.PinterestShareButton = exports.LinkedinShareButton = exports.GooglePlusShareButton = exports.WhatsappShareButton = exports.TelegramShareButton = exports.TwitterShareButton = exports.FacebookShareButton = undefined; | ||
exports.RedditShareButton = exports.OKShareButton = exports.VKShareButton = exports.PinterestShareButton = exports.LinkedinShareButton = exports.GooglePlusShareButton = exports.WhatsappShareButton = exports.TelegramShareButton = exports.TwitterShareButton = exports.FacebookShareButton = undefined; | ||
@@ -84,20 +84,26 @@ var _extends2 = require('babel-runtime/helpers/extends'); | ||
if (!disabled) { | ||
e.preventDefault(); | ||
(function () { | ||
e.preventDefault(); | ||
var windowOptions = { | ||
height: windowHeight, | ||
width: windowWidth | ||
}; | ||
var windowOptions = { | ||
height: windowHeight, | ||
width: windowWidth | ||
}; | ||
var windowOpenBound = function windowOpenBound() { | ||
return (0, _utils.windowOpen)(_this.link(), windowOptions); | ||
}; | ||
var windowOpenBound = function windowOpenBound() { | ||
return (0, _utils.windowOpen)(_this.link(), windowOptions); | ||
}; | ||
if (beforeOnClick) { | ||
beforeOnClick().then(function () { | ||
return windowOpenBound(); | ||
}); | ||
} else { | ||
windowOpenBound(); | ||
} | ||
if (beforeOnClick) { | ||
var returnVal = beforeOnClick(); | ||
if ((0, _utils.isPromise)(returnVal)) { | ||
returnVal.then(windowOpenBound); | ||
} else { | ||
windowOpenBound(); | ||
} | ||
} else { | ||
windowOpenBound(); | ||
} | ||
})(); | ||
} | ||
@@ -308,2 +314,13 @@ }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret); | ||
windowHeight: 460 | ||
}); | ||
var RedditShareButton = exports.RedditShareButton = createShareButton('reddit', function (props) { | ||
return { | ||
title: props.title | ||
}; | ||
}, { | ||
title: _propTypes2.default.string | ||
}, { | ||
windowWidth: 660, | ||
windowHeight: 460 | ||
}); |
@@ -17,2 +17,3 @@ 'use strict'; | ||
exports.getOKShareCount = getOKShareCount; | ||
exports.getRedditShareCount = getRedditShareCount; | ||
@@ -149,2 +150,10 @@ var _jsonp = require('jsonp'); | ||
})); | ||
} | ||
function getRedditShareCount(shareUrl, callback) { | ||
var endpoint = 'https://www.reddit.com/api/info.json?limit=1&url=' + shareUrl; | ||
(0, _jsonp2.default)(endpoint, { param: 'jsonp' }, function (err, response) { | ||
callback(!err && response && response.data && response.data.children.length > 0 && response.data.children[0].data.score ? response.data.children[0].data.score : undefined); | ||
}); | ||
} |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.TwitterShareCount = exports.OKShareCount = exports.VKShareCount = exports.PinterestShareCount = exports.GooglePlusShareCount = exports.LinkedinShareCount = exports.FacebookShareCount = undefined; | ||
exports.TwitterShareCount = exports.RedditShareCount = exports.OKShareCount = exports.VKShareCount = exports.PinterestShareCount = exports.GooglePlusShareCount = exports.LinkedinShareCount = exports.FacebookShareCount = undefined; | ||
@@ -147,4 +147,5 @@ var _extends2 = require('babel-runtime/helpers/extends'); | ||
var OKShareCount = exports.OKShareCount = shareCountFactory(_shareCountGetters.getOKShareCount); | ||
var RedditShareCount = exports.RedditShareCount = shareCountFactory(_shareCountGetters.getRedditShareCount); | ||
var TwitterShareCount = exports.TwitterShareCount = function TwitterShareCount() { | ||
throw new Error('TwitterShareCount was removed in version 1.3.0 because' + 'the Twitter API was shut down and there is no replacement. Please ' + 'remove it from your code.'); | ||
}; |
@@ -16,2 +16,3 @@ 'use strict'; | ||
exports.ok = ok; | ||
exports.reddit = reddit; | ||
@@ -149,2 +150,13 @@ var _assert = require('assert'); | ||
}); | ||
} | ||
function reddit(url, _ref9) { | ||
var title = _ref9.title; | ||
(0, _assert2.default)(url, 'reddit.url'); | ||
return 'https://www.reddit.com/submit' + (0, _utils.objectToGetParams)({ | ||
url: url, | ||
title: title | ||
}); | ||
} |
@@ -6,3 +6,8 @@ 'use strict'; | ||
}); | ||
exports.isPromise = undefined; | ||
var _typeof2 = require('babel-runtime/helpers/typeof'); | ||
var _typeof3 = _interopRequireDefault(_typeof2); | ||
var _keys = require('babel-runtime/core-js/object/keys'); | ||
@@ -57,2 +62,6 @@ | ||
}).join(', ')); | ||
} | ||
} | ||
var isPromise = exports.isPromise = function isPromise(obj) { | ||
return !!obj && ((typeof obj === 'undefined' ? 'undefined' : (0, _typeof3.default)(obj)) === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; | ||
}; |
{ | ||
"name": "react-share", | ||
"version": "1.13.3", | ||
"version": "1.14.0", | ||
"description": "Easy social media share buttons and share counts.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/react-share.js", |
@@ -14,5 +14,23 @@ # react-share | ||
* opens a popup share-window | ||
* sharing buttons for Facebook, Twitter, Google+, LinkedIn, Pinterest, VK, Telegram, Whatsapp and Odnoklassniki | ||
* share counts for Facebook, Google+, Linkedin, Pinterest and VK | ||
* share buttons with generated icons or custom icons of your choice | ||
* share buttons for: | ||
- Telegram | ||
- Google+ | ||
- VK | ||
- Odnoklassniki | ||
* share counts for | ||
- Google+ | ||
- VK | ||
- Odnoklassniki | ||
* social media icons included in the library | ||
* supports also custom icons | ||
@@ -63,3 +81,4 @@ #### Demo | ||
VKShareButton, | ||
OKShareButton | ||
OKShareButton, | ||
RedditShareButton, | ||
} = ShareButtons; | ||
@@ -72,3 +91,3 @@ ``` | ||
|-------|--------|--------------| | ||
|__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| | ||
|__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.| | ||
|FacebookShareButton|-|__`title`__: Title of the shared page (string)<br/>__`description`__: Description of the shared page (string)<br/>__`picture`__: An absolute link to the image that will be shared (string)| | ||
@@ -83,2 +102,3 @@ |GooglePlusShareButton|-|-| | ||
|OKShareButton|-|__`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)| | ||
|RedditShareButton|-|__`title`__: Title of the shared page (string)| | ||
@@ -99,3 +119,4 @@ ##### Notes | ||
VKShareCount, | ||
OKShareCount | ||
OKShareCount, | ||
RedditShareCount, | ||
} = ShareCounts; | ||
@@ -137,2 +158,3 @@ ``` | ||
const OKIcon = generateShareIcon('ok'); | ||
const RedditIcon = generateShareIcon('reddit'); | ||
``` | ||
@@ -139,0 +161,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54612
869
179