zcash-grant-system/frontend/client/components/Identicon.tsx

23 lines
595 B
TypeScript
Raw Normal View History

2018-09-10 09:55:26 -07:00
import React from 'react';
import makeBlockie from 'ethereum-blockies-base64';
import defaultUserImg from 'static/images/default-user.jpg';
interface Props {
address?: string;
className?: string;
2018-09-10 09:55:26 -07:00
style?: React.CSSProperties;
}
export default class Identicon extends React.PureComponent<Props> {
render() {
const { address, className } = this.props;
const blockie = address ? makeBlockie(address) : defaultUserImg;
2018-09-10 09:55:26 -07:00
const style = {
display: 'block',
...(this.props.style || {}),
};
return <img className={className} style={style} src={blockie} />;
2018-09-10 09:55:26 -07:00
}
}