blob: 6178343a7f78a72ede2a11310dd416a4b6533106 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import React from 'react';
import md5 from 'blueimp-md5';
export default React.createClass({
propTypes: {
email: React.PropTypes.string,
size: React.PropTypes.number.isRequired
},
render() {
const shouldShowAvatar = window.SS && window.SS.lf && window.SS.lf.enableGravatar;
if (!shouldShowAvatar) {
return null;
}
const emailHash = md5.md5(this.props.email || '').trim();
const url = ('' + window.SS.lf.gravatarServerUrl)
.replace('{EMAIL_MD5}', emailHash)
.replace('{SIZE}', this.props.size * 2);
return <img className="rounded"
src={url}
width={this.props.size}
height={this.props.size}
alt={this.props.email}/>;
}
});
|