Commit 76e19f15 authored by Vitor Gultzgoff's avatar Vitor Gultzgoff Committed by 陈帅

Optional prop which is used as label for Tooltip #3761 (#3778)

parent 090e1840
import React from 'react'; import React from 'react';
export interface IMiniProgressProps { export interface IMiniProgressProps {
target: number; target: number;
targetLabel: string;
color?: string; color?: string;
strokeWidth?: number; strokeWidth?: number;
percent?: number; percent?: number;
......
import React from 'react'; import React from 'react';
import { Tooltip } from 'antd'; import { Tooltip } from 'antd';
import { formatMessage } from 'umi/locale';
import styles from './index.less'; import styles from './index.less';
const MiniProgress = ({ target, color = 'rgb(19, 194, 194)', strokeWidth, percent }) => ( const MiniProgress = ({
targetLabel,
target,
color = 'rgb(19, 194, 194)',
strokeWidth,
percent,
}) => (
<div className={styles.miniProgress}> <div className={styles.miniProgress}>
<Tooltip title={`目标值: ${target}%`}> <Tooltip
title={`${targetLabel ||
formatMessage({ id: 'component.miniProgress.tooltipDefault' }).concat(': ')} ${target}%`}
>
<div className={styles.target} style={{ left: target ? `${target}%` : null }}> <div className={styles.target} style={{ left: target ? `${target}%` : null }}>
<span style={{ backgroundColor: color || null }} /> <span style={{ backgroundColor: color || null }} />
<span style={{ backgroundColor: color || null }} /> <span style={{ backgroundColor: color || null }} />
......
...@@ -2,4 +2,5 @@ export default { ...@@ -2,4 +2,5 @@ export default {
'component.tagSelect.expand': 'Expand', 'component.tagSelect.expand': 'Expand',
'component.tagSelect.collapse': 'Collapse', 'component.tagSelect.collapse': 'Collapse',
'component.tagSelect.all': 'All', 'component.tagSelect.all': 'All',
'component.miniProgress.tooltipDefault': 'Target value',
}; };
...@@ -2,4 +2,5 @@ export default { ...@@ -2,4 +2,5 @@ export default {
'component.tagSelect.expand': 'Expandir', 'component.tagSelect.expand': 'Expandir',
'component.tagSelect.collapse': 'Diminuir', 'component.tagSelect.collapse': 'Diminuir',
'component.tagSelect.all': 'Todas', 'component.tagSelect.all': 'Todas',
'component.miniProgress.tooltipDefault': 'Valor alvo',
}; };
...@@ -2,4 +2,5 @@ export default { ...@@ -2,4 +2,5 @@ export default {
'component.tagSelect.expand': '展开', 'component.tagSelect.expand': '展开',
'component.tagSelect.collapse': '收起', 'component.tagSelect.collapse': '收起',
'component.tagSelect.all': '全部', 'component.tagSelect.all': '全部',
'component.miniProgress.tooltipDefault': '目标值',
}; };
...@@ -2,4 +2,5 @@ export default { ...@@ -2,4 +2,5 @@ export default {
'component.tagSelect.expand': '展開', 'component.tagSelect.expand': '展開',
'component.tagSelect.collapse': '收起', 'component.tagSelect.collapse': '收起',
'component.tagSelect.all': '全部', 'component.tagSelect.all': '全部',
'component.miniProgress.tooltipDefault': '目标值',
}; };
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment