index.js 749 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 16 17 18 19 20
  <div
    className={
      classNames(styles.numberInfo, {
        [styles[`numberInfo${theme}`]]: theme,
      })
    }
    {...rest}
  >
    {
      title && <h4>{title}</h4>
    }
    <h6>{subTitle}</h6>
    <div>
niko's avatar
niko committed
21
      <span>{total}{suffix && <em className={styles.suffix}>{suffix}</em>}</span>
22
      {
afc163's avatar
afc163 committed
23 24 25 26 27 28
        (status || subTotal) && (
          <span className={styles.subTotal}>
            {status && <Icon type={`caret-${status}`} />}
            {subTotal}
          </span>
        )
29 30 31 32
      }
    </div>
  </div>
);