forked from rage/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverallPoints.js
More file actions
57 lines (53 loc) · 1.29 KB
/
Copy pathOverallPoints.js
File metadata and controls
57 lines (53 loc) · 1.29 KB
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
import React from "react"
import { Card, CardContent, Typography, Button } from "@material-ui/core"
import { LinearProgress } from "@material-ui/core"
import styled from "styled-components"
const ProgressLineContainer = styled.div`
display: flex;
align-items: center;
margin: 1rem 0;
div {
height: 20px;
}
`
const StyledLinearProgress = styled(LinearProgress)`
flex: 1;
margin-left: 10px;
`
export default ({ courseName, progress, refetch }) => {
const data = progress.user_course_progress.progress.sort((a, b) =>
a.group.localeCompare(b.group, undefined, {
numeric: true,
sensitivity: "base",
}),
)
return (
<Card>
<CardContent>
<Typography variant="h5" component="h2">
{courseName}
</Typography>
{data.map(group => {
return (
<>
<ProgressLineContainer>
<Typography>{group.group}</Typography>
<StyledLinearProgress
variant="determinate"
value={group.progress * 100}
/>
</ProgressLineContainer>
</>
)
})}
<Button
onClick={() => {
refetch()
}}
>
Refresh
</Button>
</CardContent>
</Card>
)
}