"DashboardAnalysis/src/components/IntroduceRow.tsx" did not exist on "34418ae2dd61247be0e1f44bd8b82f9fc89b31a1"
index.tsx 911 Bytes
Newer Older
陈帅's avatar
陈帅 committed
1
import { Icon } from 'antd';
陈帅's avatar
陈帅 committed
2
import React from 'react';
陈帅's avatar
陈帅 committed
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
import classNames from 'classnames';
import styles from './index.less';

export interface ITrendProps {
  colorful?: boolean;
  flag: 'up' | 'down';
  style?: React.CSSProperties;
  reverseColor?: boolean;
  className?: string;
}

const Trend: React.SFC<ITrendProps> = ({
  colorful = true,
  reverseColor = false,
  flag,
  children,
  className,
  ...rest
}) => {
  const classString = classNames(
    styles.trendItem,
    {
      [styles.trendItemGrey]: !colorful,
      [styles.reverseColor]: reverseColor && colorful,
    },
陈帅's avatar
陈帅 committed
28
    className,
陈帅's avatar
陈帅 committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42
  );
  return (
    <div {...rest} className={classString} title={typeof children === 'string' ? children : ''}>
      <span>{children}</span>
      {flag && (
        <span className={styles[flag]}>
          <Icon type={`caret-${flag}`} />
        </span>
      )}
    </div>
  );
};

export default Trend;