-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathindex.jsx
More file actions
115 lines (104 loc) · 3.08 KB
/
index.jsx
File metadata and controls
115 lines (104 loc) · 3.08 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
/**
=========================================================
* Material Dashboard 2 React - v2.2.0
=========================================================
* Product Page: https://www.creative-tim.com/product/material-dashboard-react
* Copyright 2023 Creative Tim (https://www.creative-tim.com)
Coded by www.creative-tim.com
=========================================================
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/
// prop-types is a library for typechecking of props
import PropTypes from "prop-types";
// @mui material components
import Card from "@mui/material/Card";
import Divider from "@mui/material/Divider";
import Icon from "@mui/material/Icon";
// Material Dashboard 2 React components
import MDBox from "components/MDBox";
import MDTypography from "components/MDTypography";
function ComplexStatisticsCard({ color, title, count, percentage, icon }) {
return (
<Card>
<MDBox display="flex" justifyContent="space-between" pt={1} px={2}>
<MDBox
variant="gradient"
bgColor={color}
color={color === "light" ? "dark" : "white"}
coloredShadow={color}
borderRadius="xl"
display="flex"
justifyContent="center"
alignItems="center"
width="4rem"
height="4rem"
mt={-3}
>
<Icon fontSize="medium" color="inherit">
{icon}
</Icon>
</MDBox>
<MDBox textAlign="right" lineHeight={1.25}>
<MDTypography variant="button" fontWeight="light" color="text">
{title}
</MDTypography>
<MDTypography variant="h4">{count}</MDTypography>
</MDBox>
</MDBox>
<Divider />
<MDBox pb={2} px={2}>
<MDTypography component="p" variant="button" color="text" display="flex">
<MDTypography
component="span"
variant="button"
fontWeight="bold"
color={percentage.color}
>
{percentage.amount}
</MDTypography>
{percentage.label}
</MDTypography>
</MDBox>
</Card>
);
}
// Setting default values for the props of ComplexStatisticsCard
ComplexStatisticsCard.defaultProps = {
color: "info",
percentage: {
color: "success",
text: "",
label: "",
},
};
// Typechecking props for the ComplexStatisticsCard
ComplexStatisticsCard.propTypes = {
color: PropTypes.oneOf([
"primary",
"secondary",
"info",
"success",
"warning",
"error",
"light",
"dark",
]),
title: PropTypes.string.isRequired,
count: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
percentage: PropTypes.shape({
color: PropTypes.oneOf([
"primary",
"secondary",
"info",
"success",
"warning",
"error",
"dark",
"white",
]),
amount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
label: PropTypes.string,
}),
icon: PropTypes.node.isRequired,
};
export default ComplexStatisticsCard;