aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/Author.js
blob: e8fe9f94b78b2ecff76ca10a1bb6ac0a1b87491c (plain) (blame)
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
import Tooltip from '@material-ui/core/Tooltip/Tooltip';
import React from 'react';
import { withStyles } from '@material-ui/core/styles';

const styles = theme => ({
  author: {
    ...theme.typography.body2,
  },
  bold: {
    fontWeight: 'bold',
  },
});

const Author = ({ author, bold, classes }) => {
  const klass = bold ? [classes.author, classes.bold] : [classes.author];

  if(!author.email) {
    return <span className={klass.join(' ')}>{author.displayName}</span>
  }

  return (
    <Tooltip title={author.email}>
      <span className={klass.join(' ')}>{author.displayName}</span>
    </Tooltip>
  );
};

export default withStyles(styles)(Author);