react-share
Advanced tools
Comparing version 1.13.0 to 1.13.1
@@ -0,1 +1,5 @@ | ||
## 1.13.1 (Apr 20, 2017) | ||
* Minor icon component fix: use `prop-types` lib instead of `React.propTypes` and use `React.Component` instead of `React.createClass`. Suppresses warnings caused by upgrading to React v. `>=15.5.0` (thanks @yurick-flama). | ||
## 1.13.0 (Mar 31, 2017) | ||
@@ -2,0 +6,0 @@ |
@@ -17,2 +17,6 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _icons = require('./icons'); | ||
@@ -31,69 +35,67 @@ | ||
return _react2.default.createClass({ | ||
propTypes: { | ||
className: _react2.default.PropTypes.string, | ||
iconBgStyle: _react2.default.PropTypes.object, | ||
logoFillColor: _react2.default.PropTypes.string, | ||
round: _react2.default.PropTypes.bool, | ||
size: _react2.default.PropTypes.number | ||
}, | ||
var Icon = function Icon(props) { | ||
var className = props.className, | ||
iconBgStyle = props.iconBgStyle, | ||
logoFillColor = props.logoFillColor, | ||
round = props.round, | ||
size = props.size; | ||
getDefaultProps: function getDefaultProps() { | ||
return { | ||
logoFillColor: 'white', | ||
size: 64 | ||
}; | ||
}, | ||
render: function render() { | ||
var _props = this.props, | ||
className = _props.className, | ||
iconBgStyle = _props.iconBgStyle, | ||
logoFillColor = _props.logoFillColor, | ||
round = _props.round, | ||
size = _props.size; | ||
var baseStyle = { | ||
width: size, | ||
height: size | ||
}; | ||
var baseStyle = { | ||
width: size, | ||
height: size | ||
}; | ||
var classes = 'social-icon social-icon--' + network + ' ' + (className || ''); | ||
var classes = 'social-icon social-icon--' + network + ' ' + (className || ''); | ||
var finalIconBgStyle = (0, _extends3.default)({}, iconBgStyle); | ||
var finalIconBgStyle = (0, _extends3.default)({}, iconBgStyle); | ||
return _react2.default.createElement( | ||
'div', | ||
{ style: baseStyle }, | ||
return _react2.default.createElement( | ||
'div', | ||
{ style: baseStyle }, | ||
_react2.default.createElement( | ||
'svg', | ||
{ | ||
viewBox: '0 0 64 64', | ||
fill: logoFillColor, | ||
width: size, | ||
height: size, | ||
className: classes }, | ||
_react2.default.createElement( | ||
'svg', | ||
{ | ||
viewBox: '0 0 64 64', | ||
fill: logoFillColor, | ||
width: size, | ||
height: size, | ||
className: classes }, | ||
_react2.default.createElement( | ||
'g', | ||
null, | ||
!round ? _react2.default.createElement('rect', { | ||
width: '64', | ||
height: '64', | ||
fill: iconConfig.color, | ||
style: finalIconBgStyle }) : _react2.default.createElement('circle', { | ||
cx: '32', | ||
cy: '32', | ||
r: '31', | ||
fill: iconConfig.color, | ||
style: finalIconBgStyle }) | ||
), | ||
_react2.default.createElement( | ||
'g', | ||
null, | ||
_react2.default.createElement('path', { d: iconConfig.icon }) | ||
) | ||
'g', | ||
null, | ||
!round ? _react2.default.createElement('rect', { | ||
width: '64', | ||
height: '64', | ||
fill: iconConfig.color, | ||
style: finalIconBgStyle }) : _react2.default.createElement('circle', { | ||
cx: '32', | ||
cy: '32', | ||
r: '31', | ||
fill: iconConfig.color, | ||
style: finalIconBgStyle }) | ||
), | ||
_react2.default.createElement( | ||
'g', | ||
null, | ||
_react2.default.createElement('path', { d: iconConfig.icon }) | ||
) | ||
); | ||
} | ||
}); | ||
) | ||
); | ||
}; | ||
Icon.propTypes = { | ||
className: _propTypes2.default.string, | ||
iconBgStyle: _propTypes2.default.object, | ||
logoFillColor: _propTypes2.default.string, | ||
round: _propTypes2.default.bool, | ||
size: _propTypes2.default.number | ||
}; | ||
Icon.defaultProps = { | ||
logoFillColor: 'white', | ||
size: 64 | ||
}; | ||
return Icon; | ||
} |
@@ -12,2 +12,22 @@ 'use strict'; | ||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); | ||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
var _inherits2 = require('babel-runtime/helpers/inherits'); | ||
var _inherits3 = _interopRequireDefault(_inherits2); | ||
var _react = require('react'); | ||
@@ -17,2 +37,6 @@ | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _classnames = require('classnames'); | ||
@@ -26,60 +50,81 @@ | ||
var SocialMediaShareCount = _react2.default.createClass({ | ||
displayName: 'SocialMediaShareCount', | ||
/* eslint-disable react/no-multi-comp */ | ||
var SocialMediaShareCount = function (_React$Component) { | ||
(0, _inherits3.default)(SocialMediaShareCount, _React$Component); | ||
propTypes: { | ||
children: _react2.default.PropTypes.func, | ||
className: _react2.default.PropTypes.string, | ||
getCount: _react2.default.PropTypes.func, | ||
url: _react2.default.PropTypes.string.isRequired | ||
}, | ||
function SocialMediaShareCount(props) { | ||
(0, _classCallCheck3.default)(this, SocialMediaShareCount); | ||
getInitialState: function getInitialState() { | ||
return { | ||
count: 0 | ||
}; | ||
}, | ||
componentDidMount: function componentDidMount() { | ||
this.updateCount(this.props.url); | ||
}, | ||
componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
if (nextProps.url !== this.props.url) { | ||
this.updateCount(nextProps.url); | ||
var _this = (0, _possibleConstructorReturn3.default)(this, (SocialMediaShareCount.__proto__ || (0, _getPrototypeOf2.default)(SocialMediaShareCount)).call(this, props)); | ||
_this._isMounted = false; | ||
_this.state = { count: 0 }; | ||
return _this; | ||
} | ||
(0, _createClass3.default)(SocialMediaShareCount, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this._isMounted = true; | ||
this.updateCount(this.props.url); | ||
} | ||
}, | ||
updateCount: function updateCount(url) { | ||
var _this = this; | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
if (nextProps.url !== this.props.url) { | ||
this.updateCount(nextProps.url); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this._isMounted = false; | ||
} | ||
}, { | ||
key: 'updateCount', | ||
value: function updateCount(url) { | ||
var _this2 = this; | ||
if (this.props.getCount) { | ||
this.setState({ | ||
isLoading: true | ||
}); | ||
if (this.props.getCount) { | ||
this.setState({ | ||
isLoading: true | ||
}); | ||
this.props.getCount(url, function (count) { | ||
if (_this.isMounted()) { | ||
_this.setState({ | ||
count: count, | ||
isLoading: false | ||
}); | ||
} | ||
}); | ||
this.props.getCount(url, function (count) { | ||
if (_this2._isMounted) { | ||
_this2.setState({ | ||
count: count, | ||
isLoading: false | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
}, | ||
render: function render() { | ||
var _state = this.state, | ||
count = _state.count, | ||
isLoading = _state.isLoading; | ||
var _props = this.props, | ||
children = _props.children, | ||
className = _props.className; | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var _state = this.state, | ||
count = _state.count, | ||
isLoading = _state.isLoading; | ||
var _props = this.props, | ||
children = _props.children, | ||
className = _props.className; | ||
return _react2.default.createElement( | ||
'div', | ||
{ className: (0, _classnames2.default)('SocialMediaShareCount', className) }, | ||
!isLoading && children(count || 0) | ||
); | ||
} | ||
}); /* eslint-disable react/no-multi-comp */ | ||
return _react2.default.createElement( | ||
'div', | ||
{ className: (0, _classnames2.default)('SocialMediaShareCount', className) }, | ||
!isLoading && children(count || 0) | ||
); | ||
} | ||
}]); | ||
return SocialMediaShareCount; | ||
}(_react2.default.Component); | ||
SocialMediaShareCount.propTypes = { | ||
children: _propTypes2.default.func, | ||
className: _propTypes2.default.string, | ||
getCount: _propTypes2.default.func, | ||
url: _propTypes2.default.string.isRequired | ||
}; | ||
@@ -86,0 +131,0 @@ SocialMediaShareCount.defaultProps = { |
{ | ||
"name": "react-share", | ||
"version": "1.13.0", | ||
"version": "1.13.1", | ||
"description": "Easy social media share buttons and share counts.", | ||
@@ -68,3 +68,4 @@ "main": "./lib/react-share.js", | ||
"jsonp": "0.2.0", | ||
"platform": "1.3.2" | ||
"platform": "1.3.2", | ||
"prop-types": "^15.5.8" | ||
}, | ||
@@ -71,0 +72,0 @@ "peerDependencies": { |
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
50523
819
6
+ Addedprop-types@^15.5.8