1import Tooltip from '@material-ui/core/Tooltip/Tooltip';
2import MAvatar from '@material-ui/core/Avatar';
3import React from 'react';
4
5const Author = ({ author, ...props }) => {
6 if (!author.email) {
7 return <span {...props}>{author.displayName}</span>;
8 }
9
10 return (
11 <Tooltip title={author.email}>
12 <span {...props}>{author.displayName}</span>
13 </Tooltip>
14 );
15};
16
17export const Avatar = ({ author, ...props }) => {
18 if (author.avatarUrl) {
19 return <MAvatar src={author.avatarUrl} {...props} />;
20 }
21
22 return <MAvatar {...props}>{author.displayName[0]}</MAvatar>;
23};
24
25export default Author;