You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

71 lines
2.0 KiB

  1. import PropTypes from 'prop-types';
  2. // material-ui
  3. import { Box, Chip, Grid, Stack, Typography } from '@mui/material';
  4. // project import
  5. import MainCard from 'components/MainCard';
  6. // assets
  7. import { RiseOutlined, FallOutlined } from '@ant-design/icons';
  8. // ==============================|| STATISTICS - ECOMMERCE CARD ||============================== //
  9. const AnalyticEcommerce = ({ color, title, count, percentage, isLoss, extra }) => (
  10. <MainCard contentSX={{ p: 2.25 }}>
  11. <Stack spacing={0.5}>
  12. <Typography variant="h6" color="textSecondary">
  13. {title}
  14. </Typography>
  15. <Grid container alignItems="center">
  16. <Grid item>
  17. <Typography variant="h4" color="inherit">
  18. {count}
  19. </Typography>
  20. </Grid>
  21. {percentage && (
  22. <Grid item>
  23. <Chip
  24. variant="combined"
  25. color={color}
  26. icon={
  27. <>
  28. {!isLoss && <RiseOutlined style={{ fontSize: '0.75rem', color: 'inherit' }} />}
  29. {isLoss && <FallOutlined style={{ fontSize: '0.75rem', color: 'inherit' }} />}
  30. </>
  31. }
  32. label={`${percentage}%`}
  33. sx={{ ml: 1.25, pl: 1 }}
  34. size="small"
  35. />
  36. </Grid>
  37. )}
  38. </Grid>
  39. </Stack>
  40. <Box sx={{ pt: 2.25 }}>
  41. <Typography variant="caption" color="textSecondary">
  42. You made an extra{' '}
  43. <Typography component="span" variant="caption" sx={{ color: `${color || 'primary'}.main` }}>
  44. {extra}
  45. </Typography>{' '}
  46. this year
  47. </Typography>
  48. </Box>
  49. </MainCard>
  50. );
  51. AnalyticEcommerce.propTypes = {
  52. color: PropTypes.string,
  53. title: PropTypes.string,
  54. count: PropTypes.string,
  55. percentage: PropTypes.number,
  56. isLoss: PropTypes.bool,
  57. extra: PropTypes.oneOfType([PropTypes.node, PropTypes.string])
  58. };
  59. AnalyticEcommerce.defaultProps = {
  60. color: 'primary'
  61. };
  62. export default AnalyticEcommerce;