2017-06-26 23:27:26 +00:00
|
|
|
// @flow
|
|
|
|
|
2017-06-26 22:27:55 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { toDataUrl } from 'ethereum-blockies';
|
2017-06-26 23:27:26 +00:00
|
|
|
import { isValidETHAddress } from 'libs/validators';
|
2017-06-26 22:27:55 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
address: string
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function Identicon(props: Props) {
|
|
|
|
// FIXME breaks on failed checksums
|
2017-06-26 23:27:26 +00:00
|
|
|
const style = !isValidETHAddress(props.address)
|
2017-06-26 22:27:55 +00:00
|
|
|
? {}
|
|
|
|
: { backgroundImage: `url(${toDataUrl(props.address.toLowerCase())})` };
|
|
|
|
return <div className="addressIdenticon" style={style} title="Address Indenticon" />;
|
|
|
|
}
|