aboutsummaryrefslogtreecommitdiff
path: root/src/components/SolutionCard/SolutionCard.js
blob: f8133dba3e9c8e9d555ca049424be1cb37e117a7 (plain)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import React from 'react';

import {
  Typography,
  Card,
  CardHeader,
  CardContent,
  IconButton,
  Avatar,
} from "@material-ui/core";

import { makeStyles } from "@material-ui/core/styles";
import TimerIcon from '@material-ui/icons/Timer';
import MoreVertIcon from '@material-ui/icons/MoreVert';


const useStyles = makeStyles(theme => ({
  root: {
    padding: theme.spacing(1),

    '& .MuiCardContent-root': {
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center',
    },

    '& .MuiTypography-h3': {
      color: theme.palette.secondary.main,
      margin: theme.spacing(2),
    },
  },

}));

const SolutionCard = ({ solution }) => {
  const classes = useStyles();

  const author = solution.author? solution.author.username : 'anonymous';
  return (
    <Card elevation={5} className={classes.root}>
      <CardHeader
        avatar={
          author === 'anonymous'?
            (<Avatar/>)
            :
            (<Avatar>{author[0].toUpperCase()}</Avatar>)
        }
        title={author}
        subheader="04.01.2020 13:20"
        action={(
          <IconButton>
            <MoreVertIcon />
          </IconButton>
        )}
      />
      <CardContent>
        <TimerIcon/>
        <Typography variant="h3">
          { solution.result }
        </Typography>
      </CardContent>

    </Card>
  )
};

export default SolutionCard;