generated from arvinxx/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jiangchu
committed
Mar 29, 2024
1 parent
ef3e5ff
commit 0070b77
Showing
11 changed files
with
382 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import { Handle, NodeProps, Position, SelectType } from '@ant-design/pro-flow'; | ||
import { FC } from 'react'; | ||
import useStyles from '../../index.style'; | ||
|
||
interface PipeNodeChild { | ||
title: string; | ||
des: string; | ||
logo: string; | ||
} | ||
|
||
interface PipeNode { | ||
stepTitle: string; | ||
title: string; | ||
des: string; | ||
logo: string; | ||
needSwitch?: boolean; | ||
children?: PipeNodeChild[]; | ||
selectType?: SelectType; | ||
} | ||
|
||
export const PipeNode: FC<NodeProps<PipeNode>> = ({ id, data }) => { | ||
const { stepTitle, title, des, logo, needSwitch = false, children = [], selectType } = data; | ||
const { styles } = useStyles(); | ||
|
||
return ( | ||
<div className={'pipeNodeWrap' + ` pipeNode-${selectType}`}> | ||
<Handle | ||
type="target" | ||
id={`${id}`} | ||
position={Position.Left} | ||
style={{ | ||
opacity: 0, | ||
top: 30, | ||
left: 3, | ||
}} | ||
/> | ||
<div className={styles.stepTitle}>{stepTitle}</div> | ||
<div className={styles.pipeNode}> | ||
<div className={styles.mainBox}> | ||
<div className={styles.logo}> | ||
<img src={logo} alt="" /> | ||
</div> | ||
<div className={styles.wrap}> | ||
<div className={styles.title}>{title}</div> | ||
<div className={styles.des}>{des}</div> | ||
</div> | ||
{needSwitch && ( | ||
<div className={styles.pipeNodeRight}> | ||
<div className={styles.switch}> | ||
<div className={styles.switchIcon}></div> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
{children.length > 0 && ( | ||
<div className={styles.children}> | ||
{children.map((item, index) => ( | ||
<div style={{ position: 'relative' }} key={item.title + ''}> | ||
{item.leftHandle && ( | ||
<Handle | ||
type="target" | ||
id={`${id}-${item.title}-target`} | ||
position={Position.Left} | ||
style={{ | ||
opacity: 0, | ||
top: 45, | ||
left: 0, | ||
}} | ||
/> | ||
)} | ||
<div className={styles.childrenBox}> | ||
<div className={styles.logo}> | ||
<img src={item.logo} alt="" /> | ||
</div> | ||
<div className={styles.wrap}> | ||
<div className={styles.title}>{item.title}</div> | ||
<div className={styles.des}>{item.des}</div> | ||
</div> | ||
</div> | ||
{item.rightHandle && ( | ||
<Handle | ||
type="source" | ||
id={`${id}-${item.title}-source`} | ||
position={Position.Right} | ||
style={{ | ||
top: 45, | ||
right: 0, | ||
opacity: 0, | ||
}} | ||
/> | ||
)} | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
<Handle | ||
type="source" | ||
id={`${id}`} | ||
position={Position.Right} | ||
style={{ | ||
top: 30, | ||
right: 3, | ||
opacity: 0, | ||
}} | ||
/> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.