aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/Comment.js
blob: a4fd1b4002c63b0e4a20f20de66257943295b4a6 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from "react";
import gql from "graphql-tag";
import { withStyles } from "@material-ui/core/styles";

import Avatar from "@material-ui/core/Avatar";
import Card from "@material-ui/core/Card";
import CardContent from "@material-ui/core/CardContent";
import CardHeader from "@material-ui/core/CardHeader";
import Typography from "@material-ui/core/Typography";

const styles = theme => ({
  comment: {
    marginBottom: theme.spacing.unit
  }
});

const Comment = withStyles(styles)(({ comment, classes }) => (
  <Card className={classes.comment}>
    <CardHeader
      avatar={
        <Avatar aria-label={comment.author.name}>
          {comment.author.name[0].toUpperCase()}
        </Avatar>
      }
      title={comment.author.name}
      subheader={comment.author.email}
    />
    <CardContent>
      <Typography component="p">{comment.message}</Typography>
    </CardContent>
  </Card>
));

Comment.fragment = gql`
  fragment Comment on Comment {
    message
    author {
      name
      email
    }
  }
`;

export default withStyles(styles)(Comment);