Improve workflow block list design and UI consistency

This commit is contained in:
Andrew Kingston 2020-09-09 12:40:44 +01:00
parent 3897852d4c
commit 0b056bf469
3 changed files with 22 additions and 60 deletions

View File

@ -1,15 +1,23 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { backendUiStore, workflowStore } from "builderStore" import { backendUiStore, workflowStore } from "builderStore"
import { WorkflowList } from "../" import WorkflowList from "../WorkflowList/WorkflowList.svelte"
import WorkflowBlock from "./WorkflowBlock.svelte" import WorkflowBlock from "./WorkflowBlock.svelte"
import blockDefinitions from "../blockDefinitions" import blockDefinitions from "../blockDefinitions"
import FlatButtonGroup from "components/userInterface/FlatButtonGroup.svelte"
let selectedTab = "TRIGGER" let selectedTab = "TRIGGER"
let definitions = [] let definitions = []
$: definitions = Object.entries(blockDefinitions[selectedTab]) $: buttonProps = [
...($workflowStore.currentWorkflow.hasTrigger()
? []
: [{ value: "TRIGGER", text: "Trigger" }]),
{ value: "ACTION", text: "Action" },
{ value: "LOGIC", text: "Logic" },
]
$: definitions = Object.entries(blockDefinitions[selectedTab])
$: { $: {
if ( if (
$workflowStore.currentWorkflow.hasTrigger() && $workflowStore.currentWorkflow.hasTrigger() &&
@ -18,65 +26,17 @@
selectedTab = "ACTION" selectedTab = "ACTION"
} }
} }
function onChangeTab(tab) {
selectedTab = tab
}
</script> </script>
<section> <section>
<div class="subtabs"> <FlatButtonGroup value={selectedTab} {buttonProps} onChange={onChangeTab} />
{#if !$workflowStore.currentWorkflow.hasTrigger()}
<span
class="hoverable"
class:selected={'TRIGGER' === selectedTab}
on:click={() => (selectedTab = 'TRIGGER')}>
Triggers
</span>
{/if}
<span
class="hoverable"
class:selected={'ACTION' === selectedTab}
on:click={() => (selectedTab = 'ACTION')}>
Actions
</span>
<span
class="hoverable"
class:selected={'LOGIC' === selectedTab}
on:click={() => (selectedTab = 'LOGIC')}>
Logic
</span>
</div>
<div id="blocklist"> <div id="blocklist">
{#each definitions as [actionId, blockDefinition]} {#each definitions as [actionId, blockDefinition]}
<WorkflowBlock {blockDefinition} {actionId} blockType={selectedTab} /> <WorkflowBlock {blockDefinition} {actionId} blockType={selectedTab} />
{/each} {/each}
</div> </div>
</section> </section>
<style>
.subtabs {
margin-top: 20px;
display: grid;
grid-auto-flow: column;
grid-auto-columns: 1fr 1fr 1fr;
margin-bottom: 12px;
}
.subtabs span {
transition: 0.3s all;
text-align: center;
color: var(--grey-7);
font-weight: 400;
padding: 8px 16px;
text-rendering: optimizeLegibility;
border: none !important;
outline: none;
}
.subtabs span.selected {
background: var(--grey-3);
color: var(--ink);
border-radius: 5px;
}
.subtabs span:not(.selected) {
color: var(--ink);
}
</style>

View File

@ -31,11 +31,11 @@
<style> <style>
.workflow-block { .workflow-block {
display: grid; display: grid;
grid-template-columns: 40px auto; grid-template-columns: 20px auto;
align-items: center; align-items: center;
margin-top: 16px; margin-top: 16px;
padding: 16px 0px; padding: 12px;
border-radius: var(--border); border-radius: var(--border-radius-m);
} }
.workflow-block:hover { .workflow-block:hover {
@ -43,7 +43,7 @@
} }
.workflow-text { .workflow-text {
margin-left: 12px; margin-left: 16px;
} }
.icon { .icon {
@ -64,6 +64,7 @@
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
margin-bottom: 5px; margin-bottom: 5px;
margin-top: 0;
} }
p { p {

View File

@ -1,7 +1,8 @@
<script> <script>
import { onMount } from "svelte" import { onMount } from "svelte"
import { backendUiStore, workflowStore } from "builderStore" import { backendUiStore, workflowStore } from "builderStore"
import { WorkflowList, BlockList } from "./" import WorkflowList from "./WorkflowList/WorkflowList.svelte"
import BlockList from "./BlockList/BlockList.svelte"
import blockDefinitions from "./blockDefinitions" import blockDefinitions from "./blockDefinitions"
let selectedTab = "WORKFLOWS" let selectedTab = "WORKFLOWS"