index.js 814 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}%`}>
jim's avatar
jim committed
9 10 11
      <div className={styles.target} style={{ left: target ? `${target}%` : null }}>
        <span style={{ backgroundColor: color || null }} />
        <span style={{ backgroundColor: color || null }} />
nikogu's avatar
nikogu committed
12
      </div>
niko's avatar
niko committed
13
    </Tooltip>
14 15 16 17
    <div className={styles.progressWrap}>
      <div
        className={styles.progress}
        style={{
jim's avatar
jim committed
18 19 20
          backgroundColor: color || null,
          width: percent ? `${percent}%` : null,
          height: strokeWidth || null,
21 22 23 24 25 26 27
        }}
      />
    </div>
  </div>
);

export default MiniProgress;