index.js 856 Bytes
Newer Older
1 2 3 4 5
import React from 'react';
import classNames from 'classnames';
import { Icon } from 'antd';
import styles from './index.less';

偏右's avatar
偏右 committed
6
export default function Result({
jim's avatar
jim committed
7 8 9 10 11 12 13
  className,
  type,
  title,
  description,
  extra,
  actions,
  ...restProps
偏右's avatar
偏右 committed
14
}) {
15 16 17 18 19 20 21 22 23 24 25 26 27 28
  const iconMap = {
    error: <Icon className={styles.error} type="close-circle" />,
    success: <Icon className={styles.success} type="check-circle" />,
  };
  const clsString = classNames(styles.result, className);
  return (
    <div className={clsString} {...restProps}>
      <div className={styles.icon}>{iconMap[type]}</div>
      <div className={styles.title}>{title}</div>
      {description && <div className={styles.description}>{description}</div>}
      {extra && <div className={styles.extra}>{extra}</div>}
      {actions && <div className={styles.actions}>{actions}</div>}
    </div>
  );
偏右's avatar
偏右 committed
29
}