index.js 776 Bytes
Newer Older
1 2 3 4 5 6
import React from 'react';
import { Icon } from 'antd';
import classNames from 'classnames';

import styles from './index.less';

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