aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/Author.js
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-03-31 21:39:14 +0200
committerGitHub <noreply@github.com>2019-03-31 21:39:14 +0200
commitdcf973867496273df0c2e8f59c5ee113a4c08bb1 (patch)
tree6f5cf130478dba3e11a7f964e29f35be0d04312f /webui/src/Author.js
parent9bc5543206ed7cba02c0bb39165c3c4db149b066 (diff)
parent22089b5e628f1356e517d24d0346a8ec2def97fc (diff)
downloadgit-bug-dcf973867496273df0c2e8f59c5ee113a4c08bb1.tar.gz
Merge pull request #104 from MichaelMure/sandhose/webui-timeline
Use Timeline API instead of raw operations
Diffstat (limited to 'webui/src/Author.js')
-rw-r--r--webui/src/Author.js29
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;