From 4c21dc609021db91e8f382c5cfa6223bafdcfb25 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Mon, 29 Nov 2021 22:26:52 -0500 Subject: [PATCH] moving board --- webapp/src/components/DAGSvgs/Board.css | 32 ++++++++++++ webapp/src/components/DAGSvgs/Board.tsx | 65 ++++++++++++++----------- 2 files changed, 69 insertions(+), 28 deletions(-) create mode 100644 webapp/src/components/DAGSvgs/Board.css diff --git a/webapp/src/components/DAGSvgs/Board.css b/webapp/src/components/DAGSvgs/Board.css new file mode 100644 index 0000000..3cbbfdd --- /dev/null +++ b/webapp/src/components/DAGSvgs/Board.css @@ -0,0 +1,32 @@ +.board-btn { + position: absolute; +} +.board-btn:hover { + background: #5e44444f; + cursor: pointer; +} +.board-btn.right { + right: 0; + top: 0; + height: 100%; + width: 5%; +} +.board-btn.left { + left: 0; + top: 0; + height: 100%; + width: 5%; +} +.board-btn.top { + left: 0; + top: 0; + height: 5%; + width: 100%; +} + +.board-btn.bottom { + left: 0; + bottom: 0; + height: 5%; + width: 100%; +} diff --git a/webapp/src/components/DAGSvgs/Board.tsx b/webapp/src/components/DAGSvgs/Board.tsx index 886f8d3..45ed5d0 100644 --- a/webapp/src/components/DAGSvgs/Board.tsx +++ b/webapp/src/components/DAGSvgs/Board.tsx @@ -1,40 +1,49 @@ -import { FC } from "react"; +import "./Board.css"; +import { FC, useState } from 'react'; +import { Point } from 'types/graphs'; import useWindowSize from "utils/useWindowSize"; import { useBoardStyles } from "./styles"; + export const SVGBoard: FC<{ graphHeight?: number, -}> =({ + children?: JSX.Element; +}> = ({ children, graphHeight = 300, }) => { - // state - const { ratioWbh } = useWindowSize(); - const { classes, theme } = useBoardStyles({}); + // state + const { ratioWbh } = useWindowSize(); + const { classes, theme } = useBoardStyles({}); + const [[offX, offY], setOffset] = useState([0, 0]) - // alias - const graphWidth = Math.round(graphHeight * ratioWbh); + // alias + const graphWidth = Math.round(graphHeight * ratioWbh); - // render - return
= 0.75 ? 'row' : 'column' - }}> -
- - - - - - - {children} - + // render + return
= 0.75 ? 'row' : 'column' + }}> +
+ + + + + + + {children} + +
+
setOffset([offX, offY - 10])}>
+
setOffset([offX - 10, offY])}>
+
setOffset([offX + 10, offY])}>
+
setOffset([offX, offY + 10])}>
-
-} + }