-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathEarningCard.js
More file actions
203 lines (191 loc) · 7.73 KB
/
EarningCard.js
File metadata and controls
203 lines (191 loc) · 7.73 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import PropTypes from 'prop-types';
import React from 'react';
// material-ui
import { makeStyles } from '@material-ui/styles';
import { Avatar, Grid, Menu, MenuItem, Typography } from '@material-ui/core';
// project imports
import MainCard from './../../../ui-component/cards/MainCard';
import SkeletonEarningCard from './../../../ui-component/cards/Skeleton/EarningCard';
// assets
import EarningIcon from './../../../assets/images/icons/earning.svg';
import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
import ArrowUpwardIcon from '@material-ui/icons/ArrowUpward';
import GetAppTwoToneIcon from '@material-ui/icons/GetAppOutlined';
import FileCopyTwoToneIcon from '@material-ui/icons/FileCopyOutlined';
import PictureAsPdfTwoToneIcon from '@material-ui/icons/PictureAsPdfOutlined';
import ArchiveTwoToneIcon from '@material-ui/icons/ArchiveOutlined';
// style constant
const useStyles = makeStyles((theme) => ({
card: {
backgroundColor: theme.palette.secondary.dark,
color: '#fff',
overflow: 'hidden',
position: 'relative',
'&>div': {
position: 'relative',
zIndex: 5
},
'&:after': {
content: '""',
position: 'absolute',
width: '210px',
height: '210px',
background: theme.palette.secondary[800],
borderRadius: '50%',
zIndex: 1,
top: '-85px',
right: '-95px',
[theme.breakpoints.down('xs')]: {
top: '-105px',
right: '-140px'
}
},
'&:before': {
content: '""',
position: 'absolute',
width: '210px',
height: '210px',
background: theme.palette.secondary[800],
borderRadius: '50%',
top: '-125px',
right: '-15px',
opacity: 0.5,
[theme.breakpoints.down('xs')]: {
top: '-155px',
right: '-70px'
}
}
},
content: {
padding: '20px !important'
},
avatar: {
...theme.typography.commonAvatar,
...theme.typography.largeAvatar,
backgroundColor: theme.palette.secondary[800],
marginTop: '8px'
},
avatarRight: {
...theme.typography.commonAvatar,
...theme.typography.mediumAvatar,
backgroundColor: theme.palette.secondary.dark,
color: theme.palette.secondary[200],
zIndex: 1
},
cardHeading: {
fontSize: '2.125rem',
fontWeight: 500,
marginRight: '8px',
marginTop: '14px',
marginBottom: '6px'
},
subHeading: {
fontSize: '1rem',
fontWeight: 500,
color: theme.palette.secondary[200]
},
avatarCircle: {
cursor: 'pointer',
...theme.typography.smallAvatar,
backgroundColor: theme.palette.secondary[200],
color: theme.palette.secondary.dark
},
circleIcon: {
transform: 'rotate3d(1, 1, 1, 45deg)'
},
menuItem: {
marginRight: '14px',
fontSize: '1.25rem'
}
}));
//===========================|| DASHBOARD DEFAULT - EARNING CARD ||===========================//
const EarningCard = ({ isLoading }) => {
const classes = useStyles();
const [anchorEl, setAnchorEl] = React.useState(null);
const handleClick = (event) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
return (
<React.Fragment>
{isLoading ? (
<SkeletonEarningCard />
) : (
<MainCard border={false} className={classes.card} contentClass={classes.content}>
<Grid container direction="column">
<Grid item>
<Grid container justifyContent="space-between">
<Grid item>
<Avatar variant="rounded" className={classes.avatar}>
<img src={EarningIcon} alt="Notification" />
</Avatar>
</Grid>
<Grid item>
<Avatar
variant="rounded"
className={classes.avatarRight}
aria-controls="menu-earning-card"
aria-haspopup="true"
onClick={handleClick}
>
<MoreHorizIcon fontSize="inherit" />
</Avatar>
<Menu
id="menu-earning-card"
anchorEl={anchorEl}
keepMounted
open={Boolean(anchorEl)}
onClose={handleClose}
variant="selectedMenu"
anchorOrigin={{
vertical: 'bottom',
horizontal: 'right'
}}
transformOrigin={{
vertical: 'top',
horizontal: 'right'
}}
>
<MenuItem onClick={handleClose}>
<GetAppTwoToneIcon fontSize="inherit" className={classes.menuItem} /> Import Card
</MenuItem>
<MenuItem onClick={handleClose}>
<FileCopyTwoToneIcon fontSize="inherit" className={classes.menuItem} /> Copy Data
</MenuItem>
<MenuItem onClick={handleClose}>
<PictureAsPdfTwoToneIcon fontSize="inherit" className={classes.menuItem} /> Export
</MenuItem>
<MenuItem onClick={handleClose}>
<ArchiveTwoToneIcon fontSize="inherit" className={classes.menuItem} /> Archive File
</MenuItem>
</Menu>
</Grid>
</Grid>
</Grid>
<Grid item>
<Grid container alignItems="center">
<Grid item>
<Typography className={classes.cardHeading}>$500.00</Typography>
</Grid>
<Grid item>
<Avatar className={classes.avatarCircle}>
<ArrowUpwardIcon fontSize="inherit" className={classes.circleIcon} />
</Avatar>
</Grid>
</Grid>
</Grid>
<Grid item sx={{ mb: 1.25 }}>
<Typography className={classes.subHeading}>Total Earning</Typography>
</Grid>
</Grid>
</MainCard>
)}
</React.Fragment>
);
};
EarningCard.propTypes = {
isLoading: PropTypes.bool
};
export default EarningCard;