Skip to content

Commit

Permalink
♻️ refactor: 优化 out 的节点逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Mar 19, 2021
1 parent 4e14640 commit 7a3c171
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
5 changes: 2 additions & 3 deletions packages/mindflow/src/components/Port/OutPort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import CollapseIcon from '../CollapseIcon';
interface OutPortProps {
color: string;
collapsed: boolean;
visible: boolean;
id: string;
}

export const OutPort: FC<OutPortProps> = ({
color,
collapsed,
visible,

id,
}) => {
return !visible ? null : (
return (
<div className="mind-port-out-port">
<CollapseIcon id={id} color={color} collapsed={collapsed} />
</div>
Expand Down
9 changes: 2 additions & 7 deletions packages/mindflow/src/definition/port.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,9 @@ export const port = (args: Hook.OnPortRenderedArgs) => {
ReactDOM.render(<InPort color={color} />, container as HTMLElement);
}

if (port.id === 'out') {
if (port.id === 'out' && !leaf) {
ReactDOM.render(
<OutPort
visible={!leaf}
color={color}
collapsed={collapsed}
id={node.id}
/>,
<OutPort color={color} collapsed={collapsed} id={node.id} />,
container as HTMLElement,
);
}
Expand Down

0 comments on commit 7a3c171

Please sign in to comment.