cleaned up styling
This commit is contained in:
1 parent
2db116ad9b
commit
8d804add13
25 files changed
+259
-186
No files matched your search
@@ -10,16 +10,7 @@ export default {
|
||||
component: AutomationEditor,
|
||||
parameters: { actions: { argTypesRegex: '^on.*' } },
|
||||
args: {
|
||||
dims: {
|
||||
nodeHeight: dgconst.NODE_HEIGHT,
|
||||
nodeWidth: dgconst.NODE_WIDTH,
|
||||
distanceFactor: dgconst.DISTANCE_FACTOR,
|
||||
circleSize: dgconst.CIRCLE_SIZE,
|
||||
padding: {
|
||||
x: dgconst.PADDING,
|
||||
y: dgconst.PADDING,
|
||||
},
|
||||
}
|
||||
dims: dgconst.DEFAULT_DIMS
|
||||
}
|
||||
} as ComponentMeta<typeof AutomationEditor>
|
||||
|
||||
@@ -43,6 +34,7 @@ export const Simple = Template.bind({})
|
||||
Simple.args = {
|
||||
...Simple.args,
|
||||
automation: {
|
||||
condition: [],
|
||||
tags: {
|
||||
"Room": "Bathroom",
|
||||
"For": "Toliet",
|
||||
@@ -103,6 +95,7 @@ export const EmptyStart = Template.bind({})
|
||||
EmptyStart.args = {
|
||||
...EmptyStart.args,
|
||||
automation: {
|
||||
condition: [],
|
||||
tags: {},
|
||||
metadata: {
|
||||
id: "random",
|
||||
|
||||
@@ -25,6 +25,7 @@ export const AutomationEditor: FC<Props> = ({
|
||||
updateSequence,
|
||||
updateTrigger,
|
||||
updateMetadata,
|
||||
updateCondition,
|
||||
save,
|
||||
} = useAutomatioEditorState(propsAutos, propsOnUpdate);
|
||||
|
||||
@@ -64,8 +65,10 @@ export const AutomationEditor: FC<Props> = ({
|
||||
className="automation-editor--flow-wrapper--flow"
|
||||
sequence={state.data.sequence}
|
||||
trigger={state.data.trigger}
|
||||
condition={state.data.condition}
|
||||
onSequenceUpdate={updateSequence}
|
||||
onTriggerUpdate={updateTrigger}
|
||||
onConditionUpdate={updateCondition}
|
||||
dims={dims}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -41,6 +41,7 @@ export const useAutomatioEditorState = (
|
||||
return {
|
||||
updateTrigger: makeUpdate('trigger'),
|
||||
updateSequence: makeUpdate('sequence'),
|
||||
updateCondition: makeUpdate('condition'),
|
||||
updateMetadata: (metadata: AutomationMetadata, tags: Array<[string, string]>) => {
|
||||
if (state.status !== 'loading') {
|
||||
update({
|
||||
@@ -80,6 +81,7 @@ const genEditorData = (automation: AutomationData) => {
|
||||
metadata,
|
||||
trigger,
|
||||
sequence,
|
||||
condition,
|
||||
} = automation;
|
||||
|
||||
const tags: [string, string][] = Object.keys(automation.tags).map(tagName => [tagName, automation.tags[tagName]]);
|
||||
@@ -88,6 +90,7 @@ const genEditorData = (automation: AutomationData) => {
|
||||
metadata,
|
||||
trigger,
|
||||
sequence,
|
||||
condition,
|
||||
tags,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user