Added condition count to the component settings panel

This commit is contained in:
Dean 2022-07-05 09:05:23 +01:00
parent 89bce468c8
commit d7c2f53a55
1 changed files with 13 additions and 1 deletions

View File

@ -28,12 +28,18 @@
} }
drawer.hide() drawer.hide()
} }
$: conditionCount = componentInstance?._conditions?.length
$: conditionText = `${conditionCount || "No"} condition${
conditionCount !== 1 ? "s" : ""
} set`
</script> </script>
<DetailSummary <DetailSummary
name={`Conditions${componentInstance?._conditions ? " *" : ""}`} name={`Conditions${conditionCount ? " *" : ""}`}
collapsible={false} collapsible={false}
> >
<div class="conditionCount">{conditionText}</div>
<div> <div>
<ActionButton on:click={openDrawer}>Configure conditions</ActionButton> <ActionButton on:click={openDrawer}>Configure conditions</ActionButton>
</div> </div>
@ -45,3 +51,9 @@
<Button cta slot="buttons" on:click={() => save()}>Save</Button> <Button cta slot="buttons" on:click={() => save()}>Save</Button>
<ConditionalUIDrawer slot="body" bind:conditions={tempValue} {bindings} /> <ConditionalUIDrawer slot="body" bind:conditions={tempValue} {bindings} />
</Drawer> </Drawer>
<style>
.conditionCount {
font-weight: 600;
}
</style>