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

偏右's avatar
偏右 committed
6 7 8
export default ({
  theme, title, subTitle, total, subTotal, status, suffix, gap, ...rest
}) => (
9 10 11 12 13 14 15 16
  <div
    className={
      classNames(styles.numberInfo, {
        [styles[`numberInfo${theme}`]]: theme,
      })
    }
    {...rest}
  >
偏右's avatar
偏右 committed
17 18 19
    {title && <div className={styles.numberInfoTitle}>{title}</div>}
    {subTitle && <div className={styles.numberInfoSubTitle}>{subTitle}</div>}
    <div className={styles.numberInfoValue} style={gap ? { marginTop: gap } : null}>
afc163's avatar
afc163 committed
20 21 22 23
      <span>
        {total}
        {suffix && <em className={styles.suffix}>{suffix}</em>}
      </span>
24
      {
afc163's avatar
afc163 committed
25 26 27
        (status || subTotal) && (
          <span className={styles.subTotal}>
            {subTotal}
afc163's avatar
afc163 committed
28
            {status && <Icon type={`caret-${status}`} />}
afc163's avatar
afc163 committed
29 30
          </span>
        )
31 32 33 34
      }
    </div>
  </div>
);