1
0
Fork 0
mirror of synced 2024-10-03 10:36:59 +13:00

adds backbutton and second level handling

This commit is contained in:
kevmodrome 2020-04-20 14:40:29 +02:00
parent 381c8158e3
commit 088ee82870
4 changed files with 47 additions and 16 deletions

View file

@ -18,7 +18,7 @@
{/each}
</ul>
<div class="panel">
<Tab components={selectedCategory.components} />
<Tab list={selectedCategory} />
</div>
</div>

View file

@ -1,17 +1,15 @@
<script>
export let icon = ""
export let name = ""
export let description = ""
export let component
</script>
<div class="component-item">
<div class="component-item" on:click>
<div class="component-icon">
<i class={icon} />
<i class={component.icon} />
</div>
<div class="component-text">
<div class="component-name">{name}</div>
<div class="component-name">{component.name}</div>
<div class="component-description">
<p>{description}</p>
<p>{component.description}</p>
</div>
</div>
</div>

View file

@ -1,10 +1,39 @@
<script>
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>
{#each components as { icon, name, description }}
<Item {icon} {name} {description} />
{#if !list.isCategory}
<button class="back-button" on:click={() => (list = category)}>Back</button>
{/if}
{#each list.type as component}
<Item {component} on:click={() => handleClick(component)} />
{/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>

View file

@ -2,7 +2,8 @@ export default {
categories: [
{
name: 'Basic',
components: [
isCategory: true,
type: [
{
name: 'Container',
description: 'This component contains things within itself',
@ -71,7 +72,8 @@ export default {
},
{
name: 'Form',
components: [
isCategory: true,
type: [
{
name: 'Button',
description: 'A basic html button that is ready for styling',
@ -104,7 +106,8 @@ export default {
},
{
name: 'Blocks',
components: [
isCategory: true,
type: [
{
name: 'Container',
description: 'This component contains things within itself',
@ -173,7 +176,8 @@ export default {
},
{
name: 'Data',
components: [
isCategory: true,
type: [
{
name: 'Container',
description: 'This component contains things within itself',