Update events editor and action components with new drawer styles

This commit is contained in:
Andrew Kingston 2021-07-20 14:34:27 +01:00
parent ee84cdcbdf
commit c1d4a415f9
3 changed files with 71 additions and 70 deletions

View File

@ -73,20 +73,10 @@
</script> </script>
<DrawerContent> <DrawerContent>
<div class="actions-list" slot="sidebar"> <Layout noPadding gap="S" slot="sidebar">
<Layout>
<ActionMenu>
<Button slot="control" secondary>Add Action</Button>
{#each actionTypes as actionType}
<MenuItem on:click={addAction(actionType)}>
{actionType.name}
</MenuItem>
{/each}
</ActionMenu>
{#if actions && actions.length > 0} {#if actions && actions.length > 0}
<div <div
class="action-dnd-container" class="actions"
use:dndzone={{ use:dndzone={{
items: actions, items: actions,
flipDurationMs, flipDurationMs,
@ -99,28 +89,33 @@
<div <div
class="action-container" class="action-container"
animate:flip={{ duration: flipDurationMs }} animate:flip={{ duration: flipDurationMs }}
>
<div
class="action-header"
class:selected={action === selectedAction} class:selected={action === selectedAction}
on:click={selectAction(action)} on:click={selectAction(action)}
> >
{index + 1}. <Icon name="DragHandle" size="XL" />
{action[EVENT_TYPE_KEY]} <div class="action-header">
{index + 1}.&nbsp;{action[EVENT_TYPE_KEY]}
</div> </div>
<div <Icon
name="Close"
hoverable
size="S"
on:click={() => deleteAction(index)} on:click={() => deleteAction(index)}
style="margin-left: auto;" />
>
<Icon size="S" hoverable name="Close" />
</div>
</div> </div>
{/each} {/each}
</div> </div>
{/if} {/if}
<ActionMenu>
<Button slot="control" secondary>Add Action</Button>
{#each actionTypes as actionType}
<MenuItem on:click={addAction(actionType)}>
{actionType.name}
</MenuItem>
{/each}
</ActionMenu>
</Layout> </Layout>
</div> <Layout noPadding>
<Layout>
{#if selectedAction} {#if selectedAction}
<div class="selected-action-container"> <div class="selected-action-container">
<svelte:component <svelte:component
@ -133,32 +128,41 @@
</DrawerContent> </DrawerContent>
<style> <style>
.action-header { .actions {
display: flex; display: flex;
flex-direction: row; flex-direction: column;
align-items: center; justify-content: flex-start;
margin-top: var(--spacing-s); align-items: stretch;
gap: var(--spacing-s);
} }
.action-header { .action-header {
margin-bottom: var(--spacing-m); color: var(--spectrum-global-color-gray-700);
font-size: var(--font-size-s);
color: var(--grey-7);
font-weight: 600;
}
.action-header:hover, flex: 1 1 auto;
.action-header.selected {
cursor: pointer;
color: var(--ink);
} }
.action-container { .action-container {
border-bottom: 1px solid var(--grey-1); background-color: var(--background);
padding: var(--spacing-s) var(--spacing-m);
border-radius: 4px;
border: var(--border-light);
transition: background-color 130ms ease-in-out, color 130ms ease-in-out,
border-color 130ms ease-in-out;
gap: var(--spacing-m);
display: flex; display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center; align-items: center;
} }
.action-container:last-child { .action-container:hover,
border-bottom: none; .action-container.selected {
background-color: var(--spectrum-global-color-gray-50);
border-color: var(--spectrum-global-color-gray-500);
cursor: pointer;
}
.action-container:hover .action-header,
.action-container.selected .action-header {
color: var(--spectrum-global-color-gray-900);
} }
</style> </style>

View File

@ -25,7 +25,7 @@
} }
</script> </script>
<Layout gap="XS"> <Layout gap="XS" noPadding>
<Select <Select
label="Datasource" label="Datasource"
bind:value={parameters.datasourceId} bind:value={parameters.datasourceId}

View File

@ -41,7 +41,7 @@
<DrawerContent> <DrawerContent>
<div class="container"> <div class="container">
<Layout noPadding> <Layout noPadding gap="S">
{#if links?.length} {#if links?.length}
<div <div
class="links" class="links"
@ -72,7 +72,7 @@
{/each} {/each}
</div> </div>
{/if} {/if}
<div class="button-container"> <div>
<Button secondary icon="Add" on:click={addLink}>Add Link</Button> <Button secondary icon="Add" on:click={addLink}>Add Link</Button>
</div> </div>
</Layout> </Layout>
@ -90,9 +90,9 @@
flex-direction: column; flex-direction: column;
justify-content: flex-start; justify-content: flex-start;
align-items: stretch; align-items: stretch;
gap: var(--spacing-s);
} }
.link { .link {
padding: 4px 8px;
gap: var(--spacing-l); gap: var(--spacing-l);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -108,7 +108,4 @@
flex: 1 1 auto; flex: 1 1 auto;
width: 0; width: 0;
} }
.button-container {
margin-left: var(--spacing-l);
}
</style> </style>