EmptyCard.tsx 1020 B

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