Skip to content

Commit

Permalink
Optional prop which is used as label for Tooltip ant-design#3761 (ant…
Browse files Browse the repository at this point in the history
  • Loading branch information
VitorGultzgoff authored and chenshuai2144 committed Mar 22, 2019
1 parent 090e184 commit 76e19f1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/Charts/MiniProgress/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
export interface IMiniProgressProps {
target: number;
targetLabel: string;
color?: string;
strokeWidth?: number;
percent?: number;
Expand Down
14 changes: 12 additions & 2 deletions src/components/Charts/MiniProgress/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import React from 'react';
import { Tooltip } from 'antd';
import { formatMessage } from 'umi/locale';

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}>
<Tooltip title={`目标值: ${target}%`}>
<Tooltip
title={`${targetLabel ||
formatMessage({ id: 'component.miniProgress.tooltipDefault' }).concat(': ')} ${target}%`}
>
<div className={styles.target} style={{ left: target ? `${target}%` : null }}>
<span style={{ backgroundColor: color || null }} />
<span style={{ backgroundColor: color || null }} />
Expand Down
1 change: 1 addition & 0 deletions src/locales/en-US/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export default {
'component.tagSelect.expand': 'Expand',
'component.tagSelect.collapse': 'Collapse',
'component.tagSelect.all': 'All',
'component.miniProgress.tooltipDefault': 'Target value',
};
1 change: 1 addition & 0 deletions src/locales/pt-BR/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export default {
'component.tagSelect.expand': 'Expandir',
'component.tagSelect.collapse': 'Diminuir',
'component.tagSelect.all': 'Todas',
'component.miniProgress.tooltipDefault': 'Valor alvo',
};
1 change: 1 addition & 0 deletions src/locales/zh-CN/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export default {
'component.tagSelect.expand': '展开',
'component.tagSelect.collapse': '收起',
'component.tagSelect.all': '全部',
'component.miniProgress.tooltipDefault': '目标值',
};
1 change: 1 addition & 0 deletions src/locales/zh-TW/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export default {
'component.tagSelect.expand': '展開',
'component.tagSelect.collapse': '收起',
'component.tagSelect.all': '全部',
'component.miniProgress.tooltipDefault': '目标值',
};

0 comments on commit 76e19f1

Please sign in to comment.