mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
2cdd4761c8
* Add digest auth and response timeline * Some css fixes * Fixed Button * More auth methods, fixed URL regex, and fix gzip * Get rid of negotiate auth * Fix proxy * Fixed GA tracking * Some very small changes and fixes * Fix content type names * Even better auth switching and timeline syntax * Some auth tweaks * CSS tweaks * Reworked toasts * Fixed timer rounding quirk * Request settings and render errors * Fixed tests * Vertical dragging and stuff * Remove beta
35 lines
878 B
JavaScript
35 lines
878 B
JavaScript
import React, {PureComponent, PropTypes} from 'react';
|
|
import crypto from 'crypto';
|
|
|
|
class GravatarImg extends PureComponent {
|
|
render () {
|
|
const {email, size: rawSize, className} = this.props;
|
|
const size = rawSize || 100;
|
|
const sanitizedEmail = email.trim().toLowerCase();
|
|
const hash = crypto
|
|
.createHash('md5')
|
|
.update(sanitizedEmail)
|
|
.digest('hex');
|
|
const url = `https://www.gravatar.com/avatar/${hash}?s=${size * 2}`;
|
|
const cssSize = `${size}px`;
|
|
return (
|
|
<img src={url}
|
|
alt="Profile picture"
|
|
className={className}
|
|
title={sanitizedEmail}
|
|
style={{width: cssSize, height: cssSize}}/>
|
|
);
|
|
}
|
|
}
|
|
|
|
GravatarImg.propTypes = {
|
|
// Required
|
|
email: PropTypes.string.isRequired,
|
|
|
|
// Optional
|
|
size: PropTypes.number,
|
|
className: PropTypes.string
|
|
};
|
|
|
|
export default GravatarImg;
|