index.js 623 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
import React from 'react';
import { Icon } from 'antd';

import styles from './index.less';

const Item = ({ title, flag, children, ...rest }) => (
  <div {...rest} className={styles.trendItem}>
    <span className={styles.title}>{title}</span>
    { flag && <span className={styles[flag]}><Icon type={`caret-${flag}`} /></span>}
    <span className={styles.value}>{children}</span>
  </div>
);

const Trend = ({ colorType, children, ...rest }) => (
  <div className={colorType ? (styles[`trend${colorType}`] || styles.trend) : styles.trend} {...rest}>
    {children}
  </div>
);

Trend.Item = Item;

export default Trend;