-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
207 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import PropTypes from "prop-types"; // Import prop-types | ||
|
||
import { Box, Typography, useTheme } from "@mui/material"; | ||
import { colorSettings } from "../theme"; | ||
|
||
const StatBox = ({ title, subtitle, icon, increase }) => { | ||
const theme = useTheme(); | ||
const colors = colorSettings(theme.palette.mode); | ||
|
||
return ( | ||
<Box width="100%" m="0 30px"> | ||
<Box display="flex" justifyContent="space-between"> | ||
<Box> | ||
{icon} | ||
<Typography | ||
variant="h4" | ||
fontWeight="bold" | ||
sx={{ color: colors.grey[100] }} | ||
> | ||
{title} | ||
</Typography> | ||
</Box> | ||
</Box> | ||
<Box></Box> | ||
<Box display="flex" justifyContent="space-between"> | ||
<Typography variant="h5" sx={{ color: colors.greenAccent[100] }}> | ||
{subtitle} | ||
</Typography> | ||
<Typography | ||
variant="h4" | ||
fontStyle="italic" | ||
sx={{ color: colors.greenAccent[600] }} | ||
> | ||
{increase} | ||
</Typography> | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
// Add prop validation using PropTypes | ||
StatBox.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
subtitle: PropTypes.string.isRequired, | ||
icon: PropTypes.element.isRequired, | ||
progress: PropTypes.number, // Change the type according to your needs | ||
increase: PropTypes.number, // Change the type according to your needs | ||
}; | ||
|
||
export default StatBox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters