Commit 81ff030b authored by chen shuai's avatar chen shuai

feat: Optimize the display of toolTips

parent 2d409d42
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';
...@@ -10,28 +9,27 @@ const MiniProgress = ({ ...@@ -10,28 +9,27 @@ const MiniProgress = ({
color = 'rgb(19, 194, 194)', color = 'rgb(19, 194, 194)',
strokeWidth, strokeWidth,
percent, percent,
}) => ( }) => {
<div className={styles.miniProgress}> return (
<Tooltip <div className={styles.miniProgress}>
title={`${targetLabel || <Tooltip title={targetLabel}>
formatMessage({ id: 'component.miniProgress.tooltipDefault' }).concat(': ')} ${target}%`} <div className={styles.target} style={{ left: target ? `${target}%` : null }}>
> <span style={{ backgroundColor: color || null }} />
<div className={styles.target} style={{ left: target ? `${target}%` : null }}> <span style={{ backgroundColor: color || null }} />
<span style={{ backgroundColor: color || null }} /> </div>
<span style={{ backgroundColor: color || null }} /> </Tooltip>
<div className={styles.progressWrap}>
<div
className={styles.progress}
style={{
backgroundColor: color || null,
width: percent ? `${percent}%` : null,
height: strokeWidth || null,
}}
/>
</div> </div>
</Tooltip>
<div className={styles.progressWrap}>
<div
className={styles.progress}
style={{
backgroundColor: color || null,
width: percent ? `${percent}%` : null,
height: strokeWidth || null,
}}
/>
</div> </div>
</div> );
); };
export default MiniProgress; export default MiniProgress;
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
z-index: 9;
width: 20px;
span { span {
position: absolute; position: absolute;
top: 0; top: 0;
......
import React, { memo } from 'react'; import React, { memo } from 'react';
import { Row, Col, Icon, Tooltip } from 'antd'; import { Row, Col, Icon, Tooltip } from 'antd';
import { FormattedMessage } from 'umi/locale'; import { FormattedMessage, formatMessage } from 'umi/locale';
import styles from './Analysis.less'; import styles from './Analysis.less';
import { ChartCard, MiniArea, MiniBar, MiniProgress, Field } from '@/components/Charts'; import { ChartCard, MiniArea, MiniBar, MiniProgress, Field } from '@/components/Charts';
import Trend from '@/components/Trend'; import Trend from '@/components/Trend';
...@@ -135,7 +135,15 @@ const IntroduceRow = memo(({ loading, visitData }) => ( ...@@ -135,7 +135,15 @@ const IntroduceRow = memo(({ loading, visitData }) => (
} }
contentHeight={46} contentHeight={46}
> >
<MiniProgress percent={78} strokeWidth={8} target={80} color="#13C2C2" /> <MiniProgress
percent={78}
strokeWidth={8}
target={80}
targetLabel={`${formatMessage({ id: 'component.miniProgress.tooltipDefault' }).concat(
': '
)}80%`}
color="#13C2C2"
/>
</ChartCard> </ChartCard>
</Col> </Col>
</Row> </Row>
......
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