budibase/packages/builder/src/components/userInterface/Layout.svelte

39 lines
1.0 KiB
Svelte
Raw Normal View History

2020-02-20 18:11:41 +01:00
<script>
2020-04-28 15:28:31 +02:00
import { goto } from "@sveltech/routify"
import { FrontendTypes } from "constants"
2020-11-19 17:41:29 +01:00
import ComponentTree from "./ComponentNavigationTree/ComponentTree.svelte"
import NavItem from "components/common/NavItem.svelte"
import { last } from "lodash/fp"
import { store, currentAsset } from "builderStore"
2020-08-13 11:15:37 +02:00
import { writable } from "svelte/store"
2020-02-20 18:11:41 +01:00
2020-12-02 15:49:43 +01:00
export let layout
2020-02-20 18:11:41 +01:00
let confirmDeleteDialog
let componentToDelete = ""
2020-08-13 11:15:37 +02:00
const dragDropStore = writable({})
2020-02-20 18:11:41 +01:00
2020-04-28 15:28:31 +02:00
const setCurrentScreenToLayout = () => {
store.actions.selectAssetType(FrontendTypes.LAYOUT)
$goto("./layouts")
2020-04-28 15:28:31 +02:00
}
2020-02-20 18:11:41 +01:00
</script>
<NavItem
border={false}
icon="ri-layout-3-line"
2020-12-02 15:15:07 +01:00
text={layout.name}
withArrow
2020-12-02 15:49:43 +01:00
selected={$store.currentComponentInfo?._id === layout.props._id}
opened={$currentAsset._id === layout._id}
on:click={setCurrentScreenToLayout} />
2020-06-01 23:16:55 +02:00
2020-12-02 15:49:43 +01:00
{#if $currentAsset._id === layout._id && layout.props._children}
2020-11-19 17:41:29 +01:00
<ComponentTree
2020-12-02 15:49:43 +01:00
layout
components={layout.props._children}
2020-08-13 11:15:37 +02:00
currentComponent={$store.currentComponentInfo}
{dragDropStore} />
2020-06-01 23:16:55 +02:00
{/if}