index.js 664 Bytes
Newer Older
偏右's avatar
偏右 committed
1 2 3 4 5 6
import React from 'react';
import { Icon } from 'antd';
import classNames from 'classnames';
import styles from './index.less';

const Trend = ({ colorful = true, flag, children, className, ...rest }) => {
jim's avatar
jim committed
7 8 9 10 11 12 13
  const classString = classNames(
    styles.trendItem,
    {
      [styles.trendItemGrey]: !colorful,
    },
    className
  );
偏右's avatar
偏右 committed
14
  return (
jim's avatar
jim committed
15
    <div {...rest} className={classString} title={typeof children === 'string' ? children : ''}>
偏右's avatar
偏右 committed
16
      <span className={styles.value}>{children}</span>
jim's avatar
jim committed
17 18 19 20 21
      {flag && (
        <span className={styles[flag]}>
          <Icon type={`caret-${flag}`} />
        </span>
      )}
偏右's avatar
偏右 committed
22 23 24 25 26
    </div>
  );
};

export default Trend;