forked from daostack/alchemy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccountImage.tsx
More file actions
31 lines (25 loc) · 853 Bytes
/
AccountImage.tsx
File metadata and controls
31 lines (25 loc) · 853 Bytes
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
26
27
28
29
30
31
import { createDataURL } from "ethereum-blockies-png";
import * as React from "react";
import { IProfileState } from "reducers/profilesReducer";
import * as css from "./Account.scss";
interface IProps {
accountAddress: string;
profile?: IProfileState;
width: number;
style?: any;
}
export default class AccountImage extends React.Component<IProps, null> {
public render(): RenderOutput {
const { accountAddress, profile, width, style } = this.props;
let url;
if (profile && profile.image && profile.image[0] && profile.image[0].contentUrl) {
url = "https://ipfs.infura.io/ipfs/" + profile.image[0].contentUrl["/"];
}
if (!url) {
url = createDataURL({
seed: accountAddress,
});
}
return (<img src={url} className={css.accountImage} width={width} style={ style ? style : {}}/>);
}
}