From 82982dd4ab5518ed68c474f70b9bc562e5268d22 Mon Sep 17 00:00:00 2001 From: Arturas Date: Thu, 29 Dec 2022 14:38:18 +0200 Subject: [PATCH] ux: Make nested and/or triggers a bit easier to read Closes #125 --- src/option-types/trigger-ref-option.tsx | 22 ++++++++++++---------- src/ui/assets/styles.scss | 5 +++++ src/ui/components/td.tsx | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/option-types/trigger-ref-option.tsx b/src/option-types/trigger-ref-option.tsx index 62fcbca..29a8cf6 100644 --- a/src/option-types/trigger-ref-option.tsx +++ b/src/option-types/trigger-ref-option.tsx @@ -6,9 +6,8 @@ import type {OptionRenderEditCtx} from '../lib/define-option.mjs'; import {defineOption} from '../lib/define-option.mjs'; import {EMPTY_ARR} from '../lib/util.mjs'; import type {TriggerRefOption} from '../public_api'; -import {BorderedBlock} from '../ui/components/block'; +import {BlockDiv} from '../ui/components/block'; import Btn from '../ui/components/btn'; -import {BinSvg} from '../ui/components/svg'; import type {TriggerConfigValue} from '../ui/components/trigger-config'; import TriggerConfig from '../ui/components/trigger-config'; import {RenderNodeMedia} from '../ui/pages/workflows-dashboard/render-node-media'; @@ -20,7 +19,7 @@ defineOption({ renderEdit({value, onChange, option: {multi}}) { return multi ? - : ; + : ; }, renderView({value}) { if (!Array.isArray(value)) { @@ -84,7 +83,7 @@ function EditMulti( } return ( -
+
{value.map((trigger, idx) => (
-
+
- - + + Remove condition + Add condition
@@ -107,10 +107,12 @@ function EditMulti( } interface EditOneProps extends ViewOneProps { + border?: boolean; + onChange(val: WorkflowTrigger): void; } -function EditOne({trigger, onChange}: EditOneProps): VNode | null { +function EditOne({border, trigger, onChange}: EditOneProps): VNode | null { const value: TriggerConfigValue = { opts: trigger?.opts ?? trigger?.trigger.def.initOptions?.() ?? {}, trigger: trigger?.trigger, @@ -128,9 +130,9 @@ function EditOne({trigger, onChange}: EditOneProps): VNode | null { }, [trigger]); return ( - + - + ); } diff --git a/src/ui/assets/styles.scss b/src/ui/assets/styles.scss index 54cf51d..ea190bd 100644 --- a/src/ui/assets/styles.scss +++ b/src/ui/assets/styles.scss @@ -15,6 +15,11 @@ $colour-err: #e56767; cursor: pointer; } + // The game's !important css makes it impossible to override the colour or width + &bordered { + border: 1px solid; + } + &underdot { border-bottom: 1px dotted #fff; } diff --git a/src/ui/components/td.tsx b/src/ui/components/td.tsx index 21ae43b..cfd3757 100644 --- a/src/ui/components/td.tsx +++ b/src/ui/components/td.tsx @@ -4,7 +4,7 @@ import {mkClass} from '../util/mk-class.mjs'; type Props = Omit, 'className'>; const Td: FunctionComponent = ({class: inClass, ...rest}) => ( - + ); export default Td;