@@ -3,6 +3,9 @@ import clsx from 'clsx'
3
3
import PropTypes from 'prop-types'
4
4
import { makeStyles } from '@material-ui/core/styles'
5
5
import { Paper , Grid , Typography } from '@material-ui/core'
6
+ import { Line } from 'react-chartjs-2'
7
+
8
+ import { subscriptionsTrendChart } from './data'
6
9
7
10
const KeyNumbers = props => {
8
11
const classes = useStyles ( )
@@ -11,62 +14,90 @@ const KeyNumbers = props => {
11
14
< >
12
15
< Grid item xs = { 6 } sm = { 3 } >
13
16
< Paper className = { classes . paper } >
14
- Subscriptions
15
17
< Grid container spacing = { 0 } >
16
18
< Grid item xs = { 6 } md = { 12 } lg = { 6 } >
19
+ < Typography variant = "body2" > Subscriptions</ Typography >
17
20
< Typography variant = "body1" className = { classes . value } >
18
21
139 < sup className = { clsx ( classes . valueChange , classes . positive ) } > +5%</ sup >
19
22
</ Typography >
20
23
</ Grid >
21
24
< Grid item xs = { 6 } md = { 12 } lg = { 6 } >
22
- -
25
+ < div className = { classes . chartContainer } >
26
+ < div className = { classes . chart } >
27
+ < Line
28
+ data = { subscriptionsTrendChart . data }
29
+ options = { subscriptionsTrendChart . options }
30
+ />
31
+ </ div >
32
+ </ div >
23
33
</ Grid >
24
34
</ Grid >
25
35
</ Paper >
26
36
</ Grid >
27
37
< Grid item xs = { 6 } sm = { 3 } >
28
38
< Paper className = { classes . paper } >
29
- Monthly Revenue
30
39
< Grid container spacing = { 0 } >
31
40
< Grid item xs = { 6 } md = { 12 } lg = { 6 } >
41
+ < Typography variant = "body2" > Monthly Revenue</ Typography >
32
42
< Typography variant = "body1" className = { classes . value } >
33
43
24350${ ' ' }
34
44
< sup className = { clsx ( classes . valueChange , classes . positive ) } > +13%</ sup >
35
45
</ Typography >
36
46
</ Grid >
37
47
< Grid item xs = { 6 } md = { 12 } lg = { 6 } >
38
- -
48
+ < div className = { classes . chartContainer } >
49
+ < div className = { classes . chart } >
50
+ < Line
51
+ data = { subscriptionsTrendChart . data }
52
+ options = { subscriptionsTrendChart . options }
53
+ />
54
+ </ div >
55
+ </ div >
39
56
</ Grid >
40
57
</ Grid >
41
58
</ Paper >
42
59
</ Grid >
43
60
< Grid item xs = { 6 } sm = { 3 } >
44
61
< Paper className = { classes . paper } >
45
- Monthly Churn
46
62
< Grid container spacing = { 0 } >
47
63
< Grid item xs = { 6 } md = { 12 } lg = { 6 } >
64
+ < Typography variant = "body2" > Monthly Churn</ Typography >
48
65
< Typography variant = "body1" className = { classes . value } >
49
66
13 < sup className = { clsx ( classes . valueChange , classes . negative ) } > +10%</ sup >
50
67
</ Typography >
51
68
</ Grid >
52
69
< Grid item xs = { 6 } md = { 12 } lg = { 6 } >
53
- -
70
+ < div className = { classes . chartContainer } >
71
+ < div className = { classes . chart } >
72
+ < Line
73
+ data = { subscriptionsTrendChart . data }
74
+ options = { subscriptionsTrendChart . options }
75
+ />
76
+ </ div >
77
+ </ div >
54
78
</ Grid >
55
79
</ Grid >
56
80
</ Paper >
57
81
</ Grid >
58
82
< Grid item xs = { 6 } sm = { 3 } >
59
83
< Paper className = { classes . paper } >
60
- Total Users
61
84
< Grid container spacing = { 0 } >
62
85
< Grid item xs = { 6 } md = { 12 } lg = { 6 } >
86
+ < Typography variant = "body2" > Total Users</ Typography >
63
87
< Typography variant = "body1" className = { classes . value } >
64
88
48205{ ' ' }
65
89
< sup className = { clsx ( classes . valueChange , classes . positive ) } > +30%</ sup >
66
90
</ Typography >
67
91
</ Grid >
68
92
< Grid item xs = { 6 } md = { 12 } lg = { 6 } >
69
- -
93
+ < div className = { classes . chartContainer } >
94
+ < div className = { classes . chart } >
95
+ < Line
96
+ data = { subscriptionsTrendChart . data }
97
+ options = { subscriptionsTrendChart . options }
98
+ />
99
+ </ div >
100
+ </ div >
70
101
</ Grid >
71
102
</ Grid >
72
103
</ Paper >
@@ -97,6 +128,18 @@ const useStyles = makeStyles(theme => ({
97
128
positive : {
98
129
color : theme . palette . text . positive ,
99
130
} ,
131
+ chartContainer : {
132
+ width : '100%' ,
133
+ position : 'relative' ,
134
+ paddingBottom : '25%' ,
135
+ } ,
136
+ chart : {
137
+ position : 'absolute' ,
138
+ width : '100%' ,
139
+ height : '100%' ,
140
+ top : 0 ,
141
+ left : 0 ,
142
+ } ,
100
143
} ) )
101
144
102
145
export default KeyNumbers
0 commit comments