index.js 890 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';

jim's avatar
jim committed
6
export default ({ theme, title, subTitle, total, subTotal, status, suffix, gap, ...rest }) => (
7
  <div
jim's avatar
jim committed
8 9 10
    className={classNames(styles.numberInfo, {
      [styles[`numberInfo${theme}`]]: theme,
    })}
11 12
    {...rest}
  >
偏右's avatar
偏右 committed
13 14 15
    {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
16 17 18 19
      <span>
        {total}
        {suffix && <em className={styles.suffix}>{suffix}</em>}
      </span>
jim's avatar
jim committed
20 21 22 23 24 25
      {(status || subTotal) && (
        <span className={styles.subTotal}>
          {subTotal}
          {status && <Icon type={`caret-${status}`} />}
        </span>
      )}
26 27 28
    </div>
  </div>
);