add duplicate condition button

This commit is contained in:
Maurits Lourens 2021-07-28 17:05:14 +02:00
parent 01a1fce0f8
commit 5f18c86d79
1 changed files with 13 additions and 1 deletions

View File

@ -101,6 +101,12 @@
conditions = conditions.filter(link => link.id !== id)
}
const duplicateCondition = id => {
const condition = conditions.find(link => link.id === id);
const duplicate = {...condition, id: generate()}
conditions = [...conditions, duplicate]
}
const handleFinalize = e => {
updateConditions(e)
dragDisabled = true
@ -235,6 +241,12 @@
bind:value={condition.referenceValue}
/>
{/if}
<Icon
name="Duplicate"
hoverable
size="S"
on:click={() => duplicateCondition(condition.id)}
/>
<Icon
name="Close"
hoverable
@ -273,7 +285,7 @@
gap: var(--spacing-l);
display: grid;
align-items: center;
grid-template-columns: auto 1fr auto 1fr 1fr 1fr 1fr auto;
grid-template-columns: auto 1fr auto 1fr 1fr 1fr 1fr auto auto;
border-radius: var(--border-radius-s);
transition: background-color ease-in-out 130ms;
}