MyEmpty.tsx 837 B

123456789101112131415161718192021222324252627282930313233
  1. import { Button, Empty } from 'antd';
  2. import classNames from 'classnames';
  3. import { useTranslation } from 'react-i18next';
  4. interface Props {
  5. className?: string;
  6. error?: boolean;
  7. description?: string;
  8. refresh?: () => void;
  9. }
  10. function MyEmpty({ className, error, description, refresh }: Props) {
  11. const { t } = useTranslation();
  12. return (
  13. <Empty
  14. image='/empty.png'
  15. imageStyle={{ width: 320, height: 196, margin: '0 auto', maxWidth: '100%', maxHeight: '100%' }}
  16. className={classNames('flex items-center justify-center flex-col h-full w-full', className)}
  17. description={
  18. error ? (
  19. <Button type='primary' onClick={refresh}>
  20. {t('try_again')}
  21. </Button>
  22. ) : (
  23. (description ?? t('no_data'))
  24. )
  25. }
  26. />
  27. );
  28. }
  29. export default MyEmpty;