Skip to content

Commit

Permalink
style: Move DataStoryCanvas styles to a separate CSS file
Browse files Browse the repository at this point in the history
  • Loading branch information
stone-lyl committed Feb 19, 2025
1 parent a255b83 commit 8ba240e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 33 deletions.
36 changes: 3 additions & 33 deletions packages/ui/src/components/DataStory/DataStoryCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { createDataStoryId, LinkCount, LinkId, NodeStatus, RequestObserverType }
import { useDragNode } from './useDragNode';
import { ReactFlowNode } from '../Node/ReactFlowNode';
import { useCopyPaste } from './controls/useCopyPaste';
import '../../styles/dataStoryCanvasStyle.css';

const nodeTypes = {
commentNodeComponent: CommentNodeComponent,
Expand Down Expand Up @@ -215,23 +216,12 @@ const Flow = ({
focusOnFlow();
}, [connect, focusOnFlow, reactFlowStore]);

const { cut, copy, paste, bufferedNodes } = useCopyPaste();

const canCopy = nodes.some(({ selected }) => selected);
const canPaste = bufferedNodes.length > 0;
useCopyPaste();

return (
<>
<style>
{`
@keyframes dash {
to {
stroke-dashoffset: -10;
}
}
.react-flow__edge:hover {
cursor: crosshair;
}
${draggedNode ? `
.react-flow__edge {
opacity: 0.5;
Expand Down Expand Up @@ -311,27 +301,7 @@ const Flow = ({
>
<DataStoryControls
onSave={onSave}
controls={[
...controls,
<button
onClick={() => cut()}
disabled={!canCopy}
>
cut
</button>,
<button
onClick={() => copy()}
disabled={!canCopy}
>
copy
</button>,
<button
onClick={() => paste({ x: 0, y: 0 })}
disabled={!canPaste}
>
paste
</button>,
]}
controls={controls}
setShowAddNode={setShowAddNode}
/>
<Background color='#E7E7E7' variant={BackgroundVariant.Lines}/>
Expand Down
9 changes: 9 additions & 0 deletions packages/ui/src/styles/dataStoryCanvasStyle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@keyframes dash {
to {
stroke-dashoffset: -10;
}
}

.react-flow__edge:hover {
cursor: crosshair;
}

0 comments on commit 8ba240e

Please sign in to comment.