From 039c0631de3d0aa75fb12cd05829a140fafd75d0 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 24 Dec 2021 11:31:58 -0500 Subject: [PATCH] nicer styling for editor close/open --- .../AutomationEditor/AutoInfoBox.css | 18 ++++++++++ .../AutomationEditor/AutoInfoBox.tsx | 33 ++++++++++--------- .../src/components/AutomationEditor/index.css | 9 +++++ .../src/components/AutomationEditor/index.tsx | 19 ++++++----- .../src/components/AutomationEditor/styles.ts | 25 ++------------ webapp/src/components/Icons/ButtonIcons.tsx | 10 ++++-- 6 files changed, 65 insertions(+), 49 deletions(-) create mode 100644 webapp/src/components/AutomationEditor/AutoInfoBox.css create mode 100644 webapp/src/components/AutomationEditor/index.css diff --git a/webapp/src/components/AutomationEditor/AutoInfoBox.css b/webapp/src/components/AutomationEditor/AutoInfoBox.css new file mode 100644 index 0000000..d4293dd --- /dev/null +++ b/webapp/src/components/AutomationEditor/AutoInfoBox.css @@ -0,0 +1,18 @@ +.automation-editor--info-box { + min-width : 25px; + padding-left : 10px; + padding-right : 10px; + display : flex; + flex-direction : column; + justify-content: flex-start; + overflow : auto; + padding-top : 5; + padding-bottom : 10; + position : relative; +} + +/* .automation-editor--info-box.hide {} */ + +.automation-editor--info-box.hide>.automation-editor--info-box-inner { + display: none; +} diff --git a/webapp/src/components/AutomationEditor/AutoInfoBox.tsx b/webapp/src/components/AutomationEditor/AutoInfoBox.tsx index 7ea1826..15aedde 100644 --- a/webapp/src/components/AutomationEditor/AutoInfoBox.tsx +++ b/webapp/src/components/AutomationEditor/AutoInfoBox.tsx @@ -1,3 +1,4 @@ +import "./AutoInfoBox.css"; import { AutomationMetadata } from "types/automations"; import InputList from "components/Inputs/InputList"; import InputText from "components/Inputs/InputText"; @@ -23,21 +24,23 @@ export const AutoInfoBox: FC = ({ }) // render - return
- - - - + return
+
+ + + + +
{children}
} diff --git a/webapp/src/components/AutomationEditor/index.css b/webapp/src/components/AutomationEditor/index.css new file mode 100644 index 0000000..3546581 --- /dev/null +++ b/webapp/src/components/AutomationEditor/index.css @@ -0,0 +1,9 @@ +.automation-editor--info-icon { + position: absolute; + right : 10px; + z-index : 10; +} + +.automation-editor--info-box.hide>.automation-editor--info-icon { + transform: rotate(180deg); +} diff --git a/webapp/src/components/AutomationEditor/index.tsx b/webapp/src/components/AutomationEditor/index.tsx index 8bd29c4..7ec6fd0 100644 --- a/webapp/src/components/AutomationEditor/index.tsx +++ b/webapp/src/components/AutomationEditor/index.tsx @@ -1,5 +1,6 @@ +import "./index.css"; import { DAGBoardElmDims } from "components/DAGSvgs/DAGBoard"; -import { InfoIcon } from "components/Icons"; +import { ArrowIcon } from "components/Icons"; import { SequenceNodes } from "components/SequenceNodes"; import { FC, useState } from "react"; import { AutomationData, AutomationSequenceNode } from "types/automations"; @@ -11,6 +12,7 @@ import { chain } from "utils/iter"; import { AutomationTrigger } from 'types/automations/triggers'; import { Modal } from "components/Modal"; import { NodeEditor } from "components/NodeEditor"; +import { ButtonIcon } from "components/Icons/ButtonIcons"; interface TriggerEditorModalState { trigger: AutomationTrigger; @@ -56,15 +58,16 @@ export const AutomationEditor: FC = ({ />} onUpdate({ ...automation, metadata })} - /> - setCloseInfo(!closeInfo)} - title={closeInfo ? "Show Metadata" : "Hide Metadata"} - /> + > + setCloseInfo(!closeInfo)} + title={closeInfo ? "Show Metadata" : "Hide Metadata"} + >{ArrowIcon} + ({ - width: closeInfo ? 0 : 'auto', - paddingLeft: '10px', - paddingRight: '10px', - display: closeInfo ? 'none' : 'flex', - flexDirection: 'column', - justifyContent: 'flex-start', - overflow: 'auto', - paddingTop: 5, - paddingBottom: 10, - position: 'relative', - }), - infoIcon: ({closeInfo, horizontalMode}) => ({ - position: 'absolute', - top: horizontalMode ? '90%' : 10, - left: horizontalMode ? "3%" : closeInfo ? "2.5%" :"20%", - zIndex: 10, - background: theme.secondary, - "&:hover": { - background: theme.secondaryAccent, - borderRadius: 100, - cursor: 'pointer', - } + infoIcon: ({horizontalMode}) => ({ + bottom: horizontalMode ? '90%' : 10 }) })) diff --git a/webapp/src/components/Icons/ButtonIcons.tsx b/webapp/src/components/Icons/ButtonIcons.tsx index 6809fa2..94841f2 100644 --- a/webapp/src/components/Icons/ButtonIcons.tsx +++ b/webapp/src/components/Icons/ButtonIcons.tsx @@ -23,6 +23,10 @@ const useButtonIconStyles = createAppUseStyles(theme => ({ })) -export const ButtonIcon: FC = props => +export const ButtonIcon: FC = ({ + children: Child, + className, + ...props +}) =>