EmptyCard.tsx 1.3 KB

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