react-avatar
Advanced tools
Comparing version 1.0.0 to 1.1.0
327
lib/demo.js
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -30,165 +30,178 @@ | ||
var Demo = function (_React$Component) { | ||
_inherits(Demo, _React$Component); | ||
_inherits(Demo, _React$Component); | ||
function Demo() { | ||
var _Object$getPrototypeO; | ||
function Demo() { | ||
var _Object$getPrototypeO; | ||
var _temp, _this, _ret; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, Demo); | ||
_classCallCheck(this, Demo); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(Demo)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.state = { | ||
name: 'Wim Mostmans', | ||
skypeId: null | ||
}, _this._onChangeName = function () { | ||
_this.setState({ | ||
name: 'Foo Bar', | ||
skypeId: null | ||
}); | ||
}, _this._onSetSkype = function () { | ||
_this.setState({ skypeId: 'sitebase' }); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_Object$getPrototypeO = Object.getPrototypeOf(Demo)).call.apply(_Object$getPrototypeO, [this].concat(args))), _this), _this.state = { | ||
name: 'Wim Mostmans', | ||
skypeId: null | ||
}, _this._onChangeName = function () { | ||
_this.setState({ | ||
name: 'Foo Bar', | ||
skypeId: null | ||
}); | ||
}, _this._onSetSkype = function () { | ||
_this.setState({ skypeId: 'sitebase' }); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_createClass(Demo, [{ | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Gravatar' | ||
), | ||
_react2.default.createElement(_index2.default, { className: 'myCustomClass', md5Email: '8c5d4c4b9ef6c68c4ff91c319d4c56be', size: 40 }), | ||
_react2.default.createElement(_index2.default, { md5Email: '8c5d4c4b9ef6c68c4ff91c319d4c56be', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { md5Email: '8c5d4c4b9ef6c68c4ff91c319d4c56be', size: 150 }), | ||
_react2.default.createElement(_index2.default, { md5Email: '8c5d4c4b9ef6c68c4ff91c319d4c56be', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Invalid gravatar' | ||
), | ||
_react2.default.createElement(_index2.default, { email: 'bla', name: 'Jim Jones', size: 80 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Google+' | ||
), | ||
_react2.default.createElement(_index2.default, { googleId: '116933859726289749306', size: 40 }), | ||
_react2.default.createElement(_index2.default, { googleId: '116933859726289749306', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { googleId: '116933859726289749306', size: 150 }), | ||
_react2.default.createElement(_index2.default, { googleId: '116933859726289749306', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Facebook' | ||
), | ||
_react2.default.createElement(_index2.default, { facebookId: '100008343750912', size: 40 }), | ||
_react2.default.createElement(_index2.default, { facebookId: '100008343750912', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { facebookId: '100008343750912', size: 150 }), | ||
_react2.default.createElement(_index2.default, { facebookId: '100008343750912', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Twitter' | ||
), | ||
_react2.default.createElement(_index2.default, { twitterHandle: 'sitebase', size: 40 }), | ||
_react2.default.createElement(_index2.default, { twitterHandle: 'sitebase', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { twitterHandle: 'sitebase', size: 150 }), | ||
_react2.default.createElement(_index2.default, { twitterHandle: 'sitebase', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Skype' | ||
), | ||
_react2.default.createElement(_index2.default, { skypeId: 'sitebase', size: 40 }), | ||
_react2.default.createElement(_index2.default, { skypeId: 'sitebase', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { skypeId: 'sitebase', size: 150 }), | ||
_react2.default.createElement(_index2.default, { skypeId: 'sitebase', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Initials' | ||
), | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'hidden' }, | ||
_react2.default.createElement( | ||
'button', | ||
{ onClick: this._onChangeName }, | ||
'Change name' | ||
), | ||
_react2.default.createElement( | ||
'button', | ||
{ onClick: this._onSetSkype }, | ||
'Set skype ID' | ||
) | ||
), | ||
_react2.default.createElement(_index2.default, { name: this.state.name, skypeId: this.state.skypeId, size: 40 }), | ||
_react2.default.createElement(_index2.default, { name: this.state.name, size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { name: this.state.name, size: 150 }), | ||
_react2.default.createElement(_index2.default, { name: this.state.name, size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Value' | ||
), | ||
_react2.default.createElement(_index2.default, { value: '86%', size: 40 }), | ||
_react2.default.createElement(_index2.default, { value: '86%', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { value: '86%', size: 150 }), | ||
_react2.default.createElement(_index2.default, { value: '86%', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Fallback to static src' | ||
), | ||
_react2.default.createElement(_index2.default, { size: 150, facebookId: 'invalidfacebookusername', src: 'https://thumbs.dreamstime.com/m/cute-monster-avatar-smiling-face-yellow-color-52010608.jpg' }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Double fallback: Facebook to Google to initials' | ||
), | ||
_react2.default.createElement(_index2.default, { facebookId: 'invalidfacebookusername', | ||
googleId: 'invalidgoogleid', | ||
name: 'Sitebase', | ||
size: 200, | ||
round: true }) | ||
) | ||
); | ||
} | ||
}]); | ||
_createClass(Demo, [{ | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement( | ||
'div', | ||
null, | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Gravatar' | ||
), | ||
_react2.default.createElement(_index2.default, { className: 'myCustomClass', md5Email: '8c5d4c4b9ef6c68c4ff91c319d4c56be', size: 40 }), | ||
_react2.default.createElement(_index2.default, { md5Email: '8c5d4c4b9ef6c68c4ff91c319d4c56be', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { md5Email: '8c5d4c4b9ef6c68c4ff91c319d4c56be', size: 150 }), | ||
_react2.default.createElement(_index2.default, { md5Email: '8c5d4c4b9ef6c68c4ff91c319d4c56be', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Invalid gravatar' | ||
), | ||
_react2.default.createElement(_index2.default, { email: 'bla', name: 'Jim Jones', size: 80 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Google+' | ||
), | ||
_react2.default.createElement(_index2.default, { googleId: '116933859726289749306', size: 40 }), | ||
_react2.default.createElement(_index2.default, { googleId: '116933859726289749306', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { googleId: '116933859726289749306', size: 150 }), | ||
_react2.default.createElement(_index2.default, { googleId: '116933859726289749306', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Facebook' | ||
), | ||
_react2.default.createElement(_index2.default, { facebookId: '100008343750912', size: 40 }), | ||
_react2.default.createElement(_index2.default, { facebookId: '100008343750912', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { facebookId: '100008343750912', size: 150 }), | ||
_react2.default.createElement(_index2.default, { facebookId: '100008343750912', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Skype' | ||
), | ||
_react2.default.createElement(_index2.default, { skypeId: 'sitebase', size: 40 }), | ||
_react2.default.createElement(_index2.default, { skypeId: 'sitebase', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { skypeId: 'sitebase', size: 150 }), | ||
_react2.default.createElement(_index2.default, { skypeId: 'sitebase', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Initials' | ||
), | ||
_react2.default.createElement( | ||
'div', | ||
{ className: 'hidden' }, | ||
_react2.default.createElement( | ||
'button', | ||
{ onClick: this._onChangeName }, | ||
'Change name' | ||
), | ||
_react2.default.createElement( | ||
'button', | ||
{ onClick: this._onSetSkype }, | ||
'Set skype ID' | ||
) | ||
), | ||
_react2.default.createElement(_index2.default, { name: this.state.name, skypeId: this.state.skypeId, size: 40 }), | ||
_react2.default.createElement(_index2.default, { name: this.state.name, size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { name: this.state.name, size: 150 }), | ||
_react2.default.createElement(_index2.default, { name: this.state.name, size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Value' | ||
), | ||
_react2.default.createElement(_index2.default, { value: '86%', size: 40 }), | ||
_react2.default.createElement(_index2.default, { value: '86%', size: 100, round: true }), | ||
_react2.default.createElement(_index2.default, { value: '86%', size: 150 }), | ||
_react2.default.createElement(_index2.default, { value: '86%', size: 200 }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Fallback to static src' | ||
), | ||
_react2.default.createElement(_index2.default, { size: 150, facebookId: 'invalidfacebookusername', src: 'https://thumbs.dreamstime.com/m/cute-monster-avatar-smiling-face-yellow-color-52010608.jpg' }) | ||
), | ||
_react2.default.createElement( | ||
'section', | ||
null, | ||
_react2.default.createElement( | ||
'h2', | ||
null, | ||
'Double fallback: Facebook to Google to initials' | ||
), | ||
_react2.default.createElement(_index2.default, { facebookId: 'invalidfacebookusername', | ||
googleId: 'invalidgoogleid', | ||
name: 'Sitebase', | ||
size: 200, | ||
round: true }) | ||
) | ||
); | ||
} | ||
}]); | ||
return Demo; | ||
return Demo; | ||
}(_react2.default.Component); | ||
@@ -195,0 +208,0 @@ |
@@ -21,2 +21,6 @@ 'use strict'; | ||
var _Twitter = require('./sources/Twitter.js'); | ||
var _Twitter2 = _interopRequireDefault(_Twitter); | ||
var _Google = require('./sources/Google.js'); | ||
@@ -50,3 +54,3 @@ | ||
var SOURCES = [_Gravatar2.default, _Facebook2.default, _Google2.default, _Skype2.default, _Value2.default, _Src2.default, _Icon2.default]; | ||
var SOURCES = [_Gravatar2.default, _Facebook2.default, _Twitter2.default, _Google2.default, _Skype2.default, _Value2.default, _Src2.default, _Icon2.default]; | ||
@@ -129,2 +133,4 @@ var Avatar = function (_React$Component) { | ||
if (newProps.twitterHandle !== this.props.twitterHandle) nextState.twitterHandle = newProps.twitterHandle; | ||
if (Object.keys(nextState) !== 0) { | ||
@@ -212,2 +218,3 @@ nextState.sourcePointer = 0; | ||
skypeId: _react2.default.PropTypes.string, | ||
twitterHandle: _react2.default.PropTypes.string, | ||
round: _react2.default.PropTypes.bool, | ||
@@ -226,2 +233,3 @@ size: _react2.default.PropTypes.number | ||
skypeId: null, | ||
twitterHandle: null, | ||
googleId: null, | ||
@@ -228,0 +236,0 @@ round: false, |
{ | ||
"name": "react-avatar", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Universal React avatar component makes it possible to generate avatars based on user information.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -66,2 +66,3 @@ # <Avatar>[![Build Status](https://travis-ci.org/Sitebase/react-avatar.svg?branch=master)](https://travis-ci.org/Sitebase/react-avatar) | ||
| `facebook-id` | *string* | | | | ||
| `twitter-handle` | *string* | | | | ||
| `google-id` | *string* | | | | ||
@@ -68,0 +69,0 @@ | `skype-id` | *string* | | | |
@@ -56,2 +56,10 @@ 'use strict'; | ||
<section> | ||
<h2>Twitter</h2> | ||
<Avatar twitterHandle="sitebase" size={40} /> | ||
<Avatar twitterHandle="sitebase" size={100} round={true} /> | ||
<Avatar twitterHandle="sitebase" size={150} /> | ||
<Avatar twitterHandle="sitebase" size={200} /> | ||
</section> | ||
<section> | ||
@@ -58,0 +66,0 @@ <h2>Skype</h2> |
@@ -7,2 +7,3 @@ 'use strict'; | ||
import facebookSource from './sources/Facebook.js'; | ||
import twitterSource from './sources/Twitter.js'; | ||
import googleSource from './sources/Google.js'; | ||
@@ -17,2 +18,3 @@ import skypeSource from './sources/Skype.js'; | ||
facebookSource, | ||
twitterSource, | ||
googleSource, | ||
@@ -40,2 +42,3 @@ skypeSource, | ||
skypeId: React.PropTypes.string, | ||
twitterHandle: React.PropTypes.string, | ||
round: React.PropTypes.bool, | ||
@@ -55,2 +58,3 @@ size: React.PropTypes.number | ||
skypeId: null, | ||
twitterHandle: null, | ||
googleId: null, | ||
@@ -101,2 +105,5 @@ round: false, | ||
if (newProps.twitterHandle !== this.props.twitterHandle) | ||
nextState.twitterHandle = newProps.twitterHandle; | ||
if(Object.keys(nextState) !== 0) { | ||
@@ -103,0 +110,0 @@ nextState.sourcePointer = 0; |
Sorry, the diff of this file is too big to display
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
1559229
34
38236
114
604