index.js 842 Bytes
Newer Older
1
import React from 'react';
nikogu's avatar
nikogu committed
2
import { Popover } from 'antd';
3 4 5 6 7

import styles from './index.less';

const MiniProgress = ({ target, color, strokeWidth, percent }) => (
  <div className={styles.miniProgress}>
nikogu's avatar
nikogu committed
8 9 10 11 12 13 14 15 16
    <Popover title={null} content={`目标值: ${target}%`}>
      <div
        className={styles.target}
        style={{ left: (target ? `${target}%` : null) }}
      >
        <span style={{ backgroundColor: (color || null) }} />
        <span style={{ backgroundColor: (color || null) }} />
      </div>
    </Popover>
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;