clean up styling
This commit is contained in:
1 parent
0aff219645
commit
9d8cc9ed3e
14 files changed
+156
-80
No files matched your search
@@ -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>
|
||||
}
|
||||
Reference in new issue
Block a user