Merge pull request #2154 from mslourens/duplicate_ui_conditions

add duplicate condition button
This commit is contained in:
Martin McKeaveney 2021-07-28 16:56:51 +01:00 committed by GitHub
commit 145cb78742
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;
}