@@ -3,6 +3,9 @@ import clsx from 'clsx'
33import PropTypes from 'prop-types'
44import { makeStyles } from '@material-ui/core/styles'
55import { Paper , Grid , Typography } from '@material-ui/core'
6+ import { Line } from 'react-chartjs-2'
7+
8+ import { subscriptionsTrendChart } from './data'
69
710const KeyNumbers = props => {
811 const classes = useStyles ( )
@@ -11,62 +14,90 @@ const KeyNumbers = props => {
1114 < >
1215 < Grid item xs = { 6 } sm = { 3 } >
1316 < Paper className = { classes . paper } >
14- Subscriptions
1517 < Grid container spacing = { 0 } >
1618 < Grid item xs = { 6 } md = { 12 } lg = { 6 } >
19+ < Typography variant = "body2" > Subscriptions</ Typography >
1720 < Typography variant = "body1" className = { classes . value } >
1821 139 < sup className = { clsx ( classes . valueChange , classes . positive ) } > +5%</ sup >
1922 </ Typography >
2023 </ Grid >
2124 < 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 >
2333 </ Grid >
2434 </ Grid >
2535 </ Paper >
2636 </ Grid >
2737 < Grid item xs = { 6 } sm = { 3 } >
2838 < Paper className = { classes . paper } >
29- Monthly Revenue
3039 < Grid container spacing = { 0 } >
3140 < Grid item xs = { 6 } md = { 12 } lg = { 6 } >
41+ < Typography variant = "body2" > Monthly Revenue</ Typography >
3242 < Typography variant = "body1" className = { classes . value } >
3343 24350${ ' ' }
3444 < sup className = { clsx ( classes . valueChange , classes . positive ) } > +13%</ sup >
3545 </ Typography >
3646 </ Grid >
3747 < 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 >
3956 </ Grid >
4057 </ Grid >
4158 </ Paper >
4259 </ Grid >
4360 < Grid item xs = { 6 } sm = { 3 } >
4461 < Paper className = { classes . paper } >
45- Monthly Churn
4662 < Grid container spacing = { 0 } >
4763 < Grid item xs = { 6 } md = { 12 } lg = { 6 } >
64+ < Typography variant = "body2" > Monthly Churn</ Typography >
4865 < Typography variant = "body1" className = { classes . value } >
4966 13 < sup className = { clsx ( classes . valueChange , classes . negative ) } > +10%</ sup >
5067 </ Typography >
5168 </ Grid >
5269 < 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 >
5478 </ Grid >
5579 </ Grid >
5680 </ Paper >
5781 </ Grid >
5882 < Grid item xs = { 6 } sm = { 3 } >
5983 < Paper className = { classes . paper } >
60- Total Users
6184 < Grid container spacing = { 0 } >
6285 < Grid item xs = { 6 } md = { 12 } lg = { 6 } >
86+ < Typography variant = "body2" > Total Users</ Typography >
6387 < Typography variant = "body1" className = { classes . value } >
6488 48205{ ' ' }
6589 < sup className = { clsx ( classes . valueChange , classes . positive ) } > +30%</ sup >
6690 </ Typography >
6791 </ Grid >
6892 < 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 >
70101 </ Grid >
71102 </ Grid >
72103 </ Paper >
@@ -97,6 +128,18 @@ const useStyles = makeStyles(theme => ({
97128 positive : {
98129 color : theme . palette . text . positive ,
99130 } ,
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+ } ,
100143} ) )
101144
102145export default KeyNumbers
0 commit comments