clean up styling
This commit is contained in:
1 parent
0aff219645
commit
9d8cc9ed3e
14 files changed
+156
-80
No files matched your search
@@ -25,7 +25,7 @@ export const ActionChooseState: OptionManager<ChooseAction> = {
|
||||
value={state.action_data.alias ?? ""}
|
||||
onChange={alias => update({ alias })}
|
||||
/>
|
||||
<InputYaml
|
||||
{/* <InputYaml
|
||||
label="Choose Sequence"
|
||||
value={state.action_data.choose}
|
||||
onChange={choose => update({ choose })}
|
||||
@@ -36,7 +36,7 @@ export const ActionChooseState: OptionManager<ChooseAction> = {
|
||||
value={state.action_data.default}
|
||||
onChange={d => update({ default: d })}
|
||||
resizable
|
||||
/>
|
||||
/> */}
|
||||
</>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
.node-editor--root {
|
||||
display : flex;
|
||||
flex-direction : column;
|
||||
justify-content: center;
|
||||
align-items : center;
|
||||
height : 100%;
|
||||
}
|
||||
|
||||
.node-editor--body-title {
|
||||
display : flex;
|
||||
flex-direction : row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.node-editor--body {
|
||||
flex : 1;
|
||||
overflow : overlay;
|
||||
width : 100%;
|
||||
min-width : fit-content;
|
||||
padding-left : 1%;
|
||||
padding-right: 1%;
|
||||
/* resize : auto;
|
||||
min-width : fit-content;
|
||||
max-height : 100%;
|
||||
min-height : fit-content; */
|
||||
}
|
||||
|
||||
.node-editor--footer {
|
||||
bottom : 0;
|
||||
left : 0;
|
||||
display : flex;
|
||||
flex-direction : row;
|
||||
justify-content: space-between;
|
||||
align-items : center;
|
||||
width : 100%;
|
||||
min-height : 50px;
|
||||
}
|
||||
@@ -1,19 +1,17 @@
|
||||
import "./index.css";
|
||||
|
||||
import { FC } from "react";
|
||||
import { useNodeEditorStyles } from "./styles";
|
||||
import { AutomationNode, AutomationNodeMapping } from 'types/automations/index';
|
||||
import { useEditorNodeState } from "./OptionManager";
|
||||
import InputList from "components/Inputs/InputList";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
|
||||
|
||||
|
||||
|
||||
export interface Props {
|
||||
node: AutomationNode
|
||||
allowedTypes?: Array<keyof AutomationNodeMapping>;
|
||||
onClose?: () => void;
|
||||
onSave?: (n: AutomationNode) => void;
|
||||
saveBtnCreateText?: boolean;
|
||||
}
|
||||
|
||||
export const NodeEditor: FC<Props> = ({
|
||||
@@ -21,34 +19,33 @@ export const NodeEditor: FC<Props> = ({
|
||||
allowedTypes = ["action", "condition", "trigger"],
|
||||
onClose = () => { },
|
||||
onSave = () => { },
|
||||
saveBtnCreateText = false,
|
||||
}) => {
|
||||
const { classes } = useNodeEditorStyles({});
|
||||
const state = useEditorNodeState(node);
|
||||
|
||||
return <div className={classes.root}>
|
||||
<div className={classes.title}>
|
||||
|
||||
</div>
|
||||
<div className={classes.body}>
|
||||
{allowedTypes.length > 1 ? <InputList
|
||||
label="Type"
|
||||
current={state.nodeType}
|
||||
options={allowedTypes}
|
||||
onChange={state.setNodeType}
|
||||
/> : <span>{state.nodeType}</span>}
|
||||
{state.nodeType !== 'condition' ? <InputList
|
||||
label={`${state.nodeType} type`}
|
||||
current={state.subType as any}
|
||||
options={state.subTypes}
|
||||
onChange={state.setSubType}
|
||||
/> : <></>}
|
||||
return <div className="node-editor--root">
|
||||
<div className="node-editor--body">
|
||||
<div className="node-editor--body-title">
|
||||
{allowedTypes.length > 1 ? <InputList
|
||||
label="Type"
|
||||
current={state.nodeType}
|
||||
options={allowedTypes}
|
||||
onChange={state.setNodeType}
|
||||
/> : <span>{state.nodeType}</span>}
|
||||
{state.nodeType !== 'condition' ? <InputList
|
||||
label={`${state.nodeType} type`}
|
||||
current={state.subType as any}
|
||||
options={state.subTypes}
|
||||
onChange={state.setSubType}
|
||||
/> : <></>}
|
||||
</div>
|
||||
{state.renderOptionList()}
|
||||
</div>
|
||||
<div className={classes.footer}>
|
||||
<div className="node-editor--footer">
|
||||
<Button onClick={onClose}>Close</Button>
|
||||
<Button onClick={() => {
|
||||
state.isReady() && onSave(state.data)
|
||||
}} disabled={!state.isReady()}>Save</Button>
|
||||
}} disabled={!state.isReady()}>{saveBtnCreateText ? "Create" : "Save"}</Button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import Color from "chroma-js";
|
||||
import { createAppUseStyles } from "styles/theme";
|
||||
|
||||
export const useNodeEditorStyles = createAppUseStyles<{
|
||||
|
||||
}>(theme => ({
|
||||
root: {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
title: {
|
||||
textAlign: 'center',
|
||||
padding: 10,
|
||||
fontWeight: 'bold',
|
||||
color: theme.secondaryAccent,
|
||||
},
|
||||
body: {
|
||||
overflow: 'auto',
|
||||
resize: 'auto',
|
||||
flexGrow: 1
|
||||
},
|
||||
footer: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
width: '100%',
|
||||
}
|
||||
}))
|
||||
Reference in new issue
Block a user