react-useravatar
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -27,3 +27,3 @@ 'use strict'; | ||
* @url https://github.com/bltnico/react-user-avatar | ||
* @version 1.0.3 | ||
* @version 1.0.4 | ||
* | ||
@@ -58,4 +58,2 @@ * @example | ||
}; | ||
_this.initState(); | ||
return _this; | ||
@@ -65,6 +63,6 @@ } | ||
_createClass(UserAvatar, [{ | ||
key: 'initState', | ||
value: function initState() { | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
this.setState({ | ||
color: this.intToRGB(this.hashCode(this.props.username)), | ||
color: this.getColor(), | ||
text: this.getText() | ||
@@ -114,2 +112,13 @@ }); | ||
/** | ||
* Get color with username | ||
* @return {String} | ||
*/ | ||
}, { | ||
key: 'getColor', | ||
value: function getColor() { | ||
return this.intToRGB(this.hashCode(this.props.username)); | ||
} | ||
/** | ||
* Get text with username | ||
@@ -159,3 +168,4 @@ * @return {String} | ||
text: { | ||
color: this.props.textColor | ||
color: this.props.textColor, | ||
fontSize: this.props.size / 3 + "px" | ||
} | ||
@@ -162,0 +172,0 @@ }; |
{ | ||
"name": "react-useravatar", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,3 +11,3 @@ 'use strict'; | ||
* @url https://github.com/bltnico/react-user-avatar | ||
* @version 1.0.3 | ||
* @version 1.0.4 | ||
* | ||
@@ -37,9 +37,7 @@ * @example | ||
} | ||
this.initState(); | ||
} | ||
initState() { | ||
componentDidMount() { | ||
this.setState({ | ||
color : this.intToRGB(this.hashCode(this.props.username)), | ||
color : this.getColor(), | ||
text : this.getText() | ||
@@ -84,2 +82,10 @@ }); | ||
/** | ||
* Get color with username | ||
* @return {String} | ||
*/ | ||
getColor() { | ||
return this.intToRGB(this.hashCode(this.props.username)); | ||
} | ||
/** | ||
* Get text with username | ||
@@ -120,2 +126,3 @@ * @return {String} | ||
color : this.props.textColor, | ||
fontSize : (this.props.size / 3) + "px" | ||
} | ||
@@ -122,0 +129,0 @@ } |
10647
315