budibase/packages/builder/src/components/design/NavigationPanel/Layout.svelte

37 lines
996 B
Svelte
Raw Normal View History

2020-02-20 18:11:41 +01:00
<script>
2020-11-19 17:41:29 +01:00
import ComponentTree from "./ComponentNavigationTree/ComponentTree.svelte"
2020-12-05 00:42:22 +01:00
import LayoutDropdownMenu from "./ComponentNavigationTree/LayoutDropdownMenu.svelte"
2020-12-02 18:07:30 +01:00
import initDragDropStore from "./ComponentNavigationTree/dragDropStore"
import NavItem from "components/common/NavItem.svelte"
import { store, selectedComponent } from "builderStore"
2020-02-20 18:11:41 +01:00
2020-12-02 15:49:43 +01:00
export let layout
export let border
2020-02-20 18:11:41 +01:00
const dragDropStore = initDragDropStore()
2020-02-20 18:11:41 +01:00
2020-12-03 18:31:38 +01:00
const selectLayout = () => {
store.actions.layouts.select(layout._id)
2020-04-28 15:28:31 +02:00
}
2020-02-20 18:11:41 +01:00
</script>
<NavItem
{border}
icon="ClassicGridView"
2020-12-02 15:15:07 +01:00
text={layout.name}
withArrow
selected={$store.selectedLayoutId === layout._id}
opened={$store.selectedLayoutId === layout._id}
on:click={selectLayout}
>
2020-12-05 10:43:00 +01:00
<LayoutDropdownMenu {layout} />
2020-12-05 00:42:22 +01:00
</NavItem>
2020-06-01 23:16:55 +02:00
{#if $store.selectedLayoutId === layout._id && layout.props?._children}
2020-11-19 17:41:29 +01:00
<ComponentTree
2020-12-02 15:49:43 +01:00
components={layout.props._children}
currentComponent={$selectedComponent}
{dragDropStore}
/>
2020-06-01 23:16:55 +02:00
{/if}