forked from tsai/budibase
5 changed files with 25 additions and 183 deletions
@ -1,47 +0,0 @@ |
|||||
<script> |
|
||||
export let item |
|
||||
</script> |
|
||||
|
|
||||
<div data-cy={item.name} class="item-item" on:click> |
|
||||
<div class="item-icon"><i class={item.icon} /></div> |
|
||||
<div class="item-text"> |
|
||||
<div class="item-name">{item.name}</div> |
|
||||
</div> |
|
||||
</div> |
|
||||
|
|
||||
<style> |
|
||||
.item-item { |
|
||||
display: flex; |
|
||||
flex-direction: row; |
|
||||
cursor: pointer; |
|
||||
justify-content: flex-start; |
|
||||
align-items: center; |
|
||||
border-radius: 5px; |
|
||||
color: var(--grey-7); |
|
||||
} |
|
||||
|
|
||||
.item-item:hover { |
|
||||
color: var(--ink); |
|
||||
} |
|
||||
|
|
||||
.item-icon { |
|
||||
border-radius: 3px; |
|
||||
display: flex; |
|
||||
} |
|
||||
|
|
||||
.item-text { |
|
||||
display: flex; |
|
||||
flex-direction: column; |
|
||||
} |
|
||||
|
|
||||
.item-name { |
|
||||
font-size: var(--font-size-xs); |
|
||||
font-weight: 500; |
|
||||
text-align: center; |
|
||||
} |
|
||||
|
|
||||
i { |
|
||||
font-size: 16px; |
|
||||
margin-right: 8px; |
|
||||
} |
|
||||
</style> |
|
||||
@ -1,64 +0,0 @@ |
|||||
<script> |
|
||||
import { createEventDispatcher } from "svelte" |
|
||||
import { store } from "builderStore" |
|
||||
import Item from "./Item.svelte" |
|
||||
|
|
||||
const dispatch = createEventDispatcher() |
|
||||
|
|
||||
export let list |
|
||||
|
|
||||
let category = list |
|
||||
|
|
||||
const handleClick = (item) => { |
|
||||
if (item.children && item.children.length > 0) { |
|
||||
list = item |
|
||||
} else { |
|
||||
dispatch("selectItem", item) |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
const goBack = () => { |
|
||||
list = category |
|
||||
} |
|
||||
</script> |
|
||||
|
|
||||
{#if !list.isCategory} |
|
||||
<button class="back-button" on:click={goBack}>Back</button> |
|
||||
{/if} |
|
||||
<div class="list"> |
|
||||
{#each list.children as item} |
|
||||
{#if !item.showOnPages || item.showOnPages.includes($store.currentPageName)} |
|
||||
<Item {item} on:click={() => handleClick(item)} /> |
|
||||
{/if} |
|
||||
{/each} |
|
||||
</div> |
|
||||
|
|
||||
<style> |
|
||||
.back-button { |
|
||||
grid-column: 1 / span 2; |
|
||||
font-size: 14px; |
|
||||
text-align: center; |
|
||||
height: 36px; |
|
||||
border-radius: 5px; |
|
||||
border: solid 1px var(--grey-3); |
|
||||
background: white; |
|
||||
cursor: pointer; |
|
||||
font-weight: 500; |
|
||||
font-family: Inter; |
|
||||
transition: all 0.3ms; |
|
||||
} |
|
||||
.back-button:hover { |
|
||||
background: var(--grey-1); |
|
||||
} |
|
||||
|
|
||||
.list { |
|
||||
display: flex; |
|
||||
flex-direction: column; |
|
||||
justify-content: flex-start; |
|
||||
align-items: stretch; |
|
||||
gap: var(--spacing-s); |
|
||||
flex-wrap: wrap; |
|
||||
padding: var(--spacing-l); |
|
||||
min-width: 120px; |
|
||||
} |
|
||||
</style> |
|
||||
Loading…
Reference in new issue