@@ -2,11 +2,7 @@ import React from 'react'
2
2
import PropTypes from 'prop-types'
3
3
import {
4
4
makeStyles ,
5
- ButtonGroup ,
6
- Button ,
7
5
Grid ,
8
- Paper ,
9
- Avatar ,
10
6
Card ,
11
7
CardHeader ,
12
8
CardContent ,
@@ -16,6 +12,14 @@ import {
16
12
} from '@material-ui/core'
17
13
import { Timeline as IconTimeline , MoreVert as IconMoreVert } from '@material-ui/icons'
18
14
15
+ const subscriptionsItems = [
16
+ { name : 'GitHub' , ratio : 55.3 , value : Math . round ( 55.3 * 144 ) } ,
17
+ { name : 'MaterialUI' , ratio : 25.7 , value : Math . round ( 25.7 * 144 ) } ,
18
+ { name : 'Google' , ratio : 15.6 , value : Math . round ( 15.6 * 144 ) } ,
19
+ { name : 'ModularCode' , ratio : 8.4 , value : Math . round ( 8.4 * 144 ) } ,
20
+ { name : 'GH' , ratio : 5.5 , value : Math . round ( 5.5 * 144 ) } ,
21
+ ]
22
+
19
23
const Subscriptions = props => {
20
24
const classes = useStyles ( )
21
25
@@ -37,26 +41,34 @@ const Subscriptions = props => {
37
41
< div className = { classes . chart } > </ div >
38
42
</ Grid >
39
43
< Grid item sm = { 3 } className = { classes . ratingBox } >
40
- < div >
41
- < Typography > GitHub.com</ Typography >
42
- < LinearProgress variant = "determinate" value = { 55 } color = "primary" />
43
- </ div >
44
- < div >
45
- < Typography > MaterialUI.com</ Typography >
46
- < LinearProgress variant = "determinate" value = { 25 } color = "primary" />
47
- </ div >
48
- < div >
49
- < Typography > Google</ Typography >
50
- < LinearProgress variant = "determinate" value = { 15 } color = "primary" />
51
- </ div >
52
- < div >
53
- < Typography > ModularCode.io</ Typography >
54
- < LinearProgress variant = "determinate" value = { 8 } color = "primary" />
55
- </ div >
56
- < div >
57
- < Typography > TypeScript</ Typography >
58
- < LinearProgress variant = "determinate" value = { 5 } color = "primary" />
59
- </ div >
44
+ { subscriptionsItems . map ( ( { name, ratio, value } ) => (
45
+ < div >
46
+ < Grid container >
47
+ < Grid item xs >
48
+ < Typography variant = "body1" > { name } </ Typography >
49
+ </ Grid >
50
+ < Grid item xs className = { classes . ratingItemValueBox } >
51
+ < Typography
52
+ align = "right"
53
+ variant = "body2"
54
+ display = "inline"
55
+ className = { classes . ratingItemValue }
56
+ >
57
+ { value }
58
+ </ Typography >
59
+ < Typography
60
+ align = "left"
61
+ variant = "body2"
62
+ color = "textSecondary"
63
+ className = { classes . ratingItemRatio }
64
+ >
65
+ { ratio } %
66
+ </ Typography >
67
+ </ Grid >
68
+ </ Grid >
69
+ < LinearProgress variant = "determinate" value = { ratio } color = "primary" />
70
+ </ div >
71
+ ) ) }
60
72
</ Grid >
61
73
</ Grid >
62
74
</ CardContent >
@@ -68,7 +80,8 @@ Subscriptions.propTypes = {}
68
80
69
81
const useStyles = makeStyles ( theme => ( {
70
82
cardHeader : {
71
- borderBottom : '1px solid rgba(24,28,33,0.06)' ,
83
+ borderBottom : '1px solid' ,
84
+ borderBottomColor : theme . palette . divider ,
72
85
} ,
73
86
cardBody : {
74
87
overflow : 'hidden' ,
@@ -83,11 +96,12 @@ const useStyles = makeStyles(theme => ({
83
96
marginRight : '.3em' ,
84
97
} ,
85
98
chartBox : {
86
- borderRight : '1px solid rgba(24,28,33,0.06)' ,
99
+ borderRight : '1px solid' ,
100
+ borderRightColor : theme . palette . divider ,
87
101
} ,
88
102
chart : {
89
103
width : '100%' ,
90
- paddingBottom : '30 %' ,
104
+ paddingBottom : '25 %' ,
91
105
background : '#efefef' ,
92
106
} ,
93
107
cardContent : {
@@ -100,6 +114,19 @@ const useStyles = makeStyles(theme => ({
100
114
flexDirection : 'column' ,
101
115
justifyContent : 'space-between' ,
102
116
} ,
117
+ ratingItemValueBox : {
118
+ textAlign : 'right' ,
119
+ fontSize : '0.7em' ,
120
+ } ,
121
+ ratingItemValue : {
122
+ display : 'inline-block' ,
123
+ } ,
124
+ ratingItemRatio : {
125
+ marginLeft : 4 ,
126
+ display : 'inline-block' ,
127
+ width : '3em' ,
128
+ // fontSize: '1em',
129
+ } ,
103
130
} ) )
104
131
105
132
export default Subscriptions
0 commit comments