index.js 849 Bytes
Newer Older
1
import React from 'react';
niko's avatar
niko committed
2
import { Tooltip } from 'antd';
3 4 5

import styles from './index.less';

nikogu's avatar
nikogu committed
6
const MiniProgress = ({ target, color = 'rgb(19, 194, 194)', strokeWidth, percent }) => (
7
  <div className={styles.miniProgress}>
niko's avatar
niko committed
8
    <Tooltip title={`目标值: ${target}%`}>
nikogu's avatar
nikogu committed
9 10 11 12 13 14 15
      <div
        className={styles.target}
        style={{ left: (target ? `${target}%` : null) }}
      >
        <span style={{ backgroundColor: (color || null) }} />
        <span style={{ backgroundColor: (color || null) }} />
      </div>
niko's avatar
niko committed
16
    </Tooltip>
17 18 19 20 21 22 23 24 25 26 27 28 29 30
    <div className={styles.progressWrap}>
      <div
        className={styles.progress}
        style={{
          backgroundColor: (color || null),
          width: (percent ? `${percent}%` : null),
          height: (strokeWidth || null),
        }}
      />
    </div>
  </div>
);

export default MiniProgress;