Skip to content

Commit 120fc79

Browse files
author
昔梦
committed
fix:标题气泡样式更改
1 parent 48397ba commit 120fc79

File tree

3 files changed

+63
-4
lines changed

3 files changed

+63
-4
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React, { useMemo } from 'react';
2+
import createIconFont from '../../utils/createIconFont';
3+
4+
const TitleMenuTooltip = ({ icon, title, description, iconFontUrl, iconSvg }: any) => {
5+
const IconBox = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl]);
6+
7+
return (
8+
<div className='xflow-node-title-menu-tooltip'>
9+
<div className='header-wrap'>
10+
<div className='icon-box-max' style={{ background: icon?.bgColor || '#F79009', marginRight: '8px' }}>
11+
{iconSvg ? iconSvg :<IconBox type={icon?.type} style={{ color: '#fff', fontSize: 13, ...icon?.style }} />}
12+
</div>
13+
<div className='title'>
14+
{title}
15+
</div>
16+
</div>
17+
<div className='description'>
18+
{description}
19+
</div>
20+
</div>
21+
)
22+
};
23+
24+
export default TitleMenuTooltip;

packages/x-flow/src/components/NodeContainer/index.less

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,40 @@
3232
justify-content: center;
3333
}
3434

35-
.node-widget{
35+
.node-widget {
3636
width: 100%;
3737
}
3838
}
39+
40+
.xflow-node-title-menu-tooltip {
41+
width: 200px;
42+
43+
.header-wrap {
44+
display: flex;
45+
align-items: flex-start;
46+
justify-content: flex-start;
47+
}
48+
49+
.title {
50+
color: #101828;
51+
display: inline-flex;
52+
}
53+
54+
.description {
55+
font-size: 12px;
56+
font-weight: normal;
57+
color: #101828;
58+
margin-top: 3px;
59+
}
60+
61+
.icon-box-max {
62+
width: 24px;
63+
height: 24px;
64+
min-width: 24px;
65+
min-height: 24px;
66+
border-radius: 6px;
67+
display: inline-flex;
68+
align-items: center;
69+
justify-content: center;
70+
}
71+
}

packages/x-flow/src/components/NodeContainer/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Popover, Typography } from 'antd';
22
import classNames from 'classnames';
33
import React, { memo, useMemo } from 'react';
44
import createIconFont from '../../utils/createIconFont';
5-
import { MenuTooltip } from '../NodesMenu';
65
import './index.less';
6+
import TitleMenuTooltip from './TitleMenuTooltip';
77

88
const { Text, Paragraph } = Typography;
99

@@ -21,7 +21,7 @@ export default memo((props: any) => {
2121
iconSvg,
2222
hideTitleTips,
2323
} = props;
24-
const IconBox = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl]);
24+
const IconBox = useMemo(() => createIconFont(iconFontUrl), [iconFontUrl])
2525

2626
return (
2727
<div
@@ -33,12 +33,14 @@ export default memo((props: any) => {
3333
<div className="node-title">
3434
{!hideTitleTips ? (
3535
<Popover
36-
content={<MenuTooltip {...props} />}
36+
overlayClassName="nodes-popover"
37+
content={<TitleMenuTooltip {...props} />}
3738
placement="bottomLeft"
3839
trigger="hover"
3940
getPopupContainer={() =>
4041
document.getElementById('xflow-container') as HTMLElement
4142
}
43+
overlayInnerStyle={{ padding: '12px 6px' }}
4244
>
4345
<span className="icon-box" style={{ background: icon?.bgColor }}>
4446
{iconSvg ? iconSvg : <IconBox {...icon} />}

0 commit comments

Comments
 (0)