cleanup component selection list

This commit is contained in:
Keviin Åberg Kultalahti 2021-04-27 17:04:50 +02:00
parent c97fc61f77
commit e0a376dd7b
1 changed files with 5 additions and 9 deletions

View File

@ -32,11 +32,8 @@
return enrichedStructure return enrichedStructure
} }
const onItemChosen = async (item, idx) => { const onItemChosen = async (item) => {
if (item.isCategory) { if (!item.isCategory) {
// Select and open this category
selectedIndex = idx
} else {
// Add this component // Add this component
await store.actions.components.create(item.component) await store.actions.components.create(item.component)
} }
@ -44,15 +41,14 @@
</script> </script>
<ActionGroup> <ActionGroup>
{#each enrichedStructure as item, idx} {#each enrichedStructure as item}
<ActionMenu disabled={!item.isCategory}> <ActionMenu disabled={!item.isCategory}>
<ActionButton <ActionButton
icon={item.icon} icon={item.icon}
size="XS"
primary primary
quiet quiet
slot="button" slot="control"
on:click={() => onItemChosen(item, idx)} on:click={() => onItemChosen(item)}
> >
{item.name} {item.name}
</ActionButton> </ActionButton>