forked from tsai/budibase
4 changed files with 47 additions and 16 deletions
@ -1,10 +1,39 @@ |
|||||
<script> |
<script> |
||||
import Item from "./Item.svelte" |
import Item from "./Item.svelte" |
||||
export let components |
export let list |
||||
|
let category = list |
||||
|
|
||||
console.log("Components: ", components) |
const handleClick = component => { |
||||
|
if (component.type && component.type.length > 0) { |
||||
|
list = component |
||||
|
} else { |
||||
|
console.log("Here be dragons that add the component! 🐉") |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const goBack = () => { |
||||
|
list = category |
||||
|
} |
||||
</script> |
</script> |
||||
|
|
||||
{#each components as { icon, name, description }} |
{#if !list.isCategory} |
||||
<Item {icon} {name} {description} /> |
<button class="back-button" on:click={() => (list = category)}>Back</button> |
||||
|
{/if} |
||||
|
|
||||
|
{#each list.type as component} |
||||
|
<Item {component} on:click={() => handleClick(component)} /> |
||||
{/each} |
{/each} |
||||
|
|
||||
|
<style> |
||||
|
.back-button { |
||||
|
font-size: 16px; |
||||
|
|
||||
|
width: 100%; |
||||
|
text-align: center; |
||||
|
height: 40px; |
||||
|
border-radius: 3px; |
||||
|
border: solid 1px #e8e8ef; |
||||
|
background: white; |
||||
|
margin-bottom: 20px; |
||||
|
} |
||||
|
</style> |
||||
|
|||||
Loading…
Reference in new issue