2
0

EmptyCard.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { FC } from 'react';
  2. import { Theme, Typography, CardContent } from '@mui/material';
  3. import { makeStyles } from '@mui/styles';
  4. import StatusIcon, { LoadingType } from '@/components/status/StatusIcon';
  5. import { EmptyCardProps } from './Types';
  6. const useStyles = makeStyles((theme: Theme) => ({
  7. wrapper: {
  8. color: theme.palette.text.primary,
  9. backgroundColor: theme.palette.background.default,
  10. flexDirection: 'column',
  11. textAlign: 'center',
  12. },
  13. text: {
  14. marginTop: theme.spacing(2),
  15. fontSize: '36px',
  16. lineHeight: '42px',
  17. fontWeight: 'bold',
  18. letterSpacing: '-0.02em',
  19. },
  20. subText: {
  21. fontSize: '18px',
  22. marginTop: theme.spacing(1),
  23. },
  24. }));
  25. const EmptyCard: FC<EmptyCardProps> = ({
  26. icon,
  27. text,
  28. wrapperClass = '',
  29. subText = '',
  30. loading = false,
  31. }) => {
  32. const classes = useStyles();
  33. return (
  34. <section className={`flex-center ${classes.wrapper} ${wrapperClass}`}>
  35. <CardContent>
  36. {loading && <StatusIcon type={LoadingType.CREATING} size={40} />}
  37. {icon}
  38. <Typography className={classes.text}>{text}</Typography>
  39. <Typography className={classes.subText}>{subText}</Typography>
  40. </CardContent>
  41. </section>
  42. );
  43. };
  44. export default EmptyCard;