standalone templates

This commit is contained in:
Michael Shanks 2020-02-21 22:56:18 +00:00
parent 5ce9bf5040
commit b2c045c0ca
1 changed files with 4 additions and 4 deletions

View File

@ -23,7 +23,7 @@
values, values,
flatten, flatten,
filter(t => !$store.components.some(c => c.name === t.component)), filter(t => !$store.components.some(c => c.name === t.component)),
map(t => ({ name: splitName(t.component), template: t })), map(t => ({ name: splitName(t.component).componentName, template: t })),
uniqBy(t => t.name) uniqBy(t => t.name)
]) ])
@ -47,7 +47,7 @@
if (component.template) { if (component.template) {
onTemplateChosen(component.template) onTemplateChosen(component.template)
} else { } else {
store.addChildComponent(component) store.addChildComponent(component.name)
} }
} }
@ -133,7 +133,7 @@
<div class="component-container"> <div class="component-container">
<div <div
class="component" class="component"
on:click={() => onComponentChosen(component.name)}> on:click={() => onComponentChosen(component)}>
<div class="name">{splitName(component.name).componentName}</div> <div class="name">{splitName(component.name).componentName}</div>
{#if (component.presets || templatesByComponent[component.name]) && component.name === selectedComponent} {#if (component.presets || templatesByComponent[component.name]) && component.name === selectedComponent}
<ul class="preset-menu"> <ul class="preset-menu">
@ -141,7 +141,7 @@
<span>{splitName(component.name).componentName} Presets</span> <span>{splitName(component.name).componentName} Presets</span>
{#each Object.keys(component.presets) as preset} {#each Object.keys(component.presets) as preset}
<li <li
on:click|stopPropagation={() => onComponentChosen(component.name, preset)}> on:click|stopPropagation={() => onComponentChosen(component, preset)}>
{preset} {preset}
</li> </li>
{/each} {/each}