index.js 682 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
import React from 'react';
import { Icon } from 'antd';
import classNames from 'classnames';

import styles from './index.less';

export default ({ theme, title, subTitle, total, subTotal, status, ...rest }) => (
  <div
    className={
      classNames(styles.numberInfo, {
        [styles[`numberInfo${theme}`]]: theme,
      })
    }
    {...rest}
  >
    {
      title && <h4>{title}</h4>
    }
    <h6>{subTitle}</h6>
    <div>
      <span>{total}</span>
      {
        (status || subTotal) && <span className={styles.subTotal}>
          {
            status && <Icon type={`caret-${status}`} />
          }
          {subTotal}
        </span>
      }
    </div>
  </div>
);