From 12d086a5c0420cb10432d411a036e64f124f5078 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 12 Nov 2021 14:59:22 -0500 Subject: [PATCH] adjusting dims for info box --- .../AutomationEditor/AutoInfoBox.tsx | 36 ++++++------- web/src/components/AutomationEditor/index.tsx | 51 ++++++++++-------- web/src/styles/common.scss | 2 +- web/src/styles/components/AutomationDAG.scss | 54 +++++++++++-------- web/src/styles/components/InputWrapper.scss | 3 -- web/src/utils/useWindowSize.ts | 3 ++ 6 files changed, 81 insertions(+), 68 deletions(-) diff --git a/web/src/components/AutomationEditor/AutoInfoBox.tsx b/web/src/components/AutomationEditor/AutoInfoBox.tsx index b41392f..5663b7e 100644 --- a/web/src/components/AutomationEditor/AutoInfoBox.tsx +++ b/web/src/components/AutomationEditor/AutoInfoBox.tsx @@ -19,24 +19,20 @@ export default function AutoInfoBox({ }) // render - return - -
- - - - -
-
-
+ return
+ + + + +
} \ No newline at end of file diff --git a/web/src/components/AutomationEditor/index.tsx b/web/src/components/AutomationEditor/index.tsx index a21a372..510914c 100644 --- a/web/src/components/AutomationEditor/index.tsx +++ b/web/src/components/AutomationEditor/index.tsx @@ -1,4 +1,5 @@ import { AutomationData } from "~/automations/types"; +import useWindowSize from "~/utils/useWindowSize"; import AutoInfoBox from "./AutoInfoBox"; interface Props { @@ -10,32 +11,38 @@ export default function AutomationEditor({ onUpdate, }: Props) { - const graphWidth = 300; - const graphHeight = 300; + const {ratioWbh} = useWindowSize(); - return
- - - - - - + const graphHeight = 300; + const graphWidth = Math.round(graphHeight * ratioWbh); + console.log({ratioWbh, graphHeight, graphWidth}) + return
= 0.75 ? 'row' : 'column' + }}> onUpdate({...automation, metadata})} /> - {/* */} - {/* - - - - - */} - +
+ + + + + + + {/* */} + {/* + + + + + */} + +
} \ No newline at end of file diff --git a/web/src/styles/common.scss b/web/src/styles/common.scss index 1a5ecab..33801cd 100644 --- a/web/src/styles/common.scss +++ b/web/src/styles/common.scss @@ -103,7 +103,7 @@ textarea { @extend button; cursor: text; margin: 0; - width: 100%; + width: 98%; height: 100%; } span.checkbox { diff --git a/web/src/styles/components/AutomationDAG.scss b/web/src/styles/components/AutomationDAG.scss index d197a52..10b2952 100644 --- a/web/src/styles/components/AutomationDAG.scss +++ b/web/src/styles/components/AutomationDAG.scss @@ -1,34 +1,44 @@ -.automation-dag { +.automation-editor { height: 99%; width: 99%; - border: 1px solid $secondary-accent; font-size: 0.5em; color: $primary-accent; + display: flex; + flex-direction: row; - svg { - height: 100%; + &-dag { + border: 1px solid $secondary-accent; width: 100%; - padding: 0; - margin: 0; + svg { + height: 99%; + width: 99%; + padding: 0; + margin: 0; + } } - &-title { - .input-wrapper { - max-height: 100%; - max-width: 100%; - height: 100%; - width: 100%; + &-info-box { + display: flex; + flex-direction: column; + justify-content: flex-start; + overflow: auto; - * { - margin: 0; - } - input, - textarea, - div { - font-size: 1em; - resize: none; - } - } + // .input-wrapper { + // max-height: 100%; + // max-width: 100%; + // height: 100%; + // width: 100%; + + // * { + // margin: 0; + // } + // input, + // textarea, + // div { + // font-size: 1em; + // resize: none; + // } + // } } .edge { stroke: $secondary-accent; diff --git a/web/src/styles/components/InputWrapper.scss b/web/src/styles/components/InputWrapper.scss index b77ad5b..0ec4a3f 100644 --- a/web/src/styles/components/InputWrapper.scss +++ b/web/src/styles/components/InputWrapper.scss @@ -16,9 +16,6 @@ input { padding-top: 0.65em; } - textarea { - max-width: 94%; - } // .input-view { // @extend input; // cursor: default; diff --git a/web/src/utils/useWindowSize.ts b/web/src/utils/useWindowSize.ts index a1f44fe..8adabdd 100644 --- a/web/src/utils/useWindowSize.ts +++ b/web/src/utils/useWindowSize.ts @@ -4,6 +4,7 @@ import { useState, useEffect } from "react"; interface Size { width: number; height: number; + ratioWbh: number; } // Hook @@ -13,6 +14,7 @@ export default function useWindowSize(): Size { const [windowSize, setWindowSize] = useState({ width: window.innerWidth, height: window.innerHeight, + ratioWbh: window.innerWidth / window.innerHeight, }); useEffect(() => { @@ -22,6 +24,7 @@ export default function useWindowSize(): Size { setWindowSize({ width: window.innerWidth, height: window.innerHeight, + ratioWbh: window.innerWidth / window.innerHeight, }); }