refactor(stlyes): use react-flow__container helper

This commit is contained in:
moklick
2021-11-04 15:13:14 +01:00
parent 31ad12ec9c
commit 72f1d8b4e3
12 changed files with 108 additions and 190 deletions
+25
View File
@@ -0,0 +1,25 @@
import React, { ReactNode } from 'react';
import { useStore } from '../../store';
import { ReactFlowState } from '../../types';
const selector = (s: ReactFlowState) => s.transform;
type ViewportProps = {
children: ReactNode;
};
function Viewport({ children }: ViewportProps) {
const transform = useStore(selector);
return (
<div
className="react-flow__viewport react-flow__container"
style={{ transform: `translate(${transform[0]}px,${transform[1]}px) scale(${transform[2]})` }}
>
{children}
</div>
);
}
export default Viewport;