Skip to content

Commit

Permalink
feat(free-demo): enable switch line while readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
louisyoungx committed Feb 28, 2025
1 parent 651b821 commit 7484c5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const NodeWrap = styled.div`
&:hover {
background-color: hsl(252deg 62% 55% / 9%);
color: hsl(252 62% 54.9%);
},
}
`;

const NodeLabel = styled.div`
Expand Down
11 changes: 2 additions & 9 deletions apps/demo-free-layout/src/components/tools/switch-line.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
import { useCallback } from 'react';

import { usePlayground, useService, WorkflowLinesManager } from '@flowgram.ai/free-layout-editor';
import { useService, WorkflowLinesManager } from '@flowgram.ai/free-layout-editor';
import { IconButton, Tooltip } from '@douyinfe/semi-ui';

import { IconSwitchLine } from '../../assets/icon-switch-line';

export const SwitchLine = () => {
const playground = usePlayground();
const linesManager = useService(WorkflowLinesManager);
const switchLine = useCallback(() => {
linesManager.switchLineType();
}, [linesManager]);

return (
<Tooltip content={'Switch Line'}>
<IconButton
disabled={playground.config.readonly}
type="tertiary"
theme="borderless"
onClick={switchLine}
icon={IconSwitchLine}
/>
<IconButton type="tertiary" theme="borderless" onClick={switchLine} icon={IconSwitchLine} />
</Tooltip>
);
};

0 comments on commit 7484c5a

Please sign in to comment.