aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/BugSummary.js
blob: 461fe2d00de577eaf97dcada55a2409da5b3d976 (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
45
46
47
48
49
50
51
import React from "react";
import gql from "graphql-tag";
import { withStyles } from "@material-ui/core/styles";

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

const styles = theme => ({
  labelList: {
    display: "flex",
    flexWrap: "wrap",
    marginTop: theme.spacing.unit
  },
  label: {
    marginRight: theme.spacing.unit
  },
  summary: {
    marginBottom: theme.spacing.unit * 2
  }
});

const BugSummary = ({ bug, classes }) => (
  <Card className={classes.summary}>
    <CardContent>
      <Typography variant="headline" component="h2">
        {bug.title}
      </Typography>
      <Typography variant="subheading" component="h3" title={bug.id}>
        #{bug.id.slice(0, 8)}{bug.status.toUpperCase()}
      </Typography>
      <div className={classes.labelList}>
        {bug.labels.map(label => (
          <Chip key={label} label={label} className={classes.label} />
        ))}
      </div>
    </CardContent>
  </Card>
);

BugSummary.fragment = gql`
  fragment BugSummary on Bug {
    id
    title
    status
    labels
  }
`;

export default withStyles(styles)(BugSummary);