index.js 886 B

1234567891011121314151617181920212223242526272829
  1. import React from 'react';
  2. import classNames from 'classnames';
  3. import { Icon } from 'antd';
  4. import styles from './index.less';
  5. export default function Result({
  6. className,
  7. type,
  8. title,
  9. description,
  10. extra,
  11. actions,
  12. ...restProps
  13. }) {
  14. const iconMap = {
  15. error: <Icon className={styles.error} type="close-circle" theme="filled" />,
  16. success: <Icon className={styles.success} type="check-circle" theme="filled" />,
  17. };
  18. const clsString = classNames(styles.result, className);
  19. return (
  20. <div className={clsString} {...restProps}>
  21. <div className={styles.icon}>{iconMap[type]}</div>
  22. <div className={styles.title}>{title}</div>
  23. {description && <div className={styles.description}>{description}</div>}
  24. {extra && <div className={styles.extra}>{extra}</div>}
  25. {actions && <div className={styles.actions}>{actions}</div>}
  26. </div>
  27. );
  28. }