diff options
Diffstat (limited to 'webui/src/Author.js')
-rw-r--r-- | webui/src/Author.js | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/webui/src/Author.js b/webui/src/Author.js index 7285ed4b..7bb1bf3c 100644 --- a/webui/src/Author.js +++ b/webui/src/Author.js @@ -1,28 +1,25 @@ -import { withStyles } from '@material-ui/core/styles'; import Tooltip from '@material-ui/core/Tooltip/Tooltip'; +import MAvatar from '@material-ui/core/Avatar'; import React from 'react'; -const styles = theme => ({ - author: { - ...theme.typography.body2, - }, - bold: { - fontWeight: 'bold', - }, -}); - -const Author = ({ author, bold, classes }) => { - const klass = bold ? [classes.author, classes.bold] : [classes.author]; - +const Author = ({ author, ...props }) => { if (!author.email) { - return <span className={klass.join(' ')}>{author.displayName}</span>; + return <span {...props}>{author.displayName}</span>; } return ( <Tooltip title={author.email}> - <span className={klass.join(' ')}>{author.displayName}</span> + <span {...props}>{author.displayName}</span> </Tooltip> ); }; -export default withStyles(styles)(Author); +export const Avatar = ({ author, ...props }) => { + if (author.avatarUrl) { + return <MAvatar src={author.avatarUrl} {...props} />; + } + + return <MAvatar {...props}>{author.displayName[0]}</MAvatar>; +}; + +export default Author; |