budibase/packages/builder/src/userInterface/UserInterfaceRoot.svelte

165 lines
3.7 KiB
Svelte
Raw Normal View History

2019-07-13 11:35:57 +02:00
<script>
import ComponentsHierarchy from "./ComponentsHierarchy.svelte";
import PagesList from "./PagesList.svelte"
2019-07-31 09:09:04 +02:00
import { store } from "../builderStore";
2019-08-04 23:21:16 +02:00
import getIcon from "../common/icon";
2019-09-03 13:12:24 +02:00
import { isComponent } from "./pagesParsing/searchComponents";
import IconButton from "../common/IconButton.svelte";
import Modal from "../common/Modal.svelte";
import NewComponent from "./NewComponent.svelte";
2019-08-19 22:18:23 +02:00
import CurrentItemPreview from "./CurrentItemPreview.svelte";
import SettingsView from "./SettingsView.svelte";
2019-09-03 13:12:24 +02:00
import PageView from "./PageView.svelte";
import ComponentsPaneSwitcher from "./ComponentsPaneSwitcher.svelte";
let newComponentPicker;
const newComponent = () => {
2019-08-16 16:48:45 +02:00
newComponentPicker.show();
}
2019-07-13 11:35:57 +02:00
2019-08-19 22:18:23 +02:00
let settingsView;
const settings = () => {
settingsView.show();
}
2019-07-13 11:35:57 +02:00
</script>
2019-07-26 18:08:59 +02:00
<div class="root">
2019-07-30 09:31:07 +02:00
<div class="ui-nav">
2019-07-31 09:09:04 +02:00
<div class="components-list-container">
<div class="nav-group-header">
<div>{@html getIcon("sidebar","18")}</div>
<span class="components-nav-header">Screens</span>
<div>
<IconButton icon="settings"
size="14px"
2019-08-19 22:18:23 +02:00
on:click={settings}/>
<IconButton icon="plus"
2019-08-16 16:48:45 +02:00
on:click={newComponent}/>
</div>
</div>
<div class="nav-items-container">
<ComponentsHierarchy components={$store.screens}/>
</div>
</div>
<div class="pages-list-container">
<div class="nav-group-header">
<div>{@html getIcon("grid","18")}</div>
<span>Pages</span>
</div>
<div class="nav-items-container">
<PagesList />
</div>
</div>
2019-07-26 18:08:59 +02:00
</div>
2019-07-30 09:31:07 +02:00
<div class="preview-pane">
{#if $store.currentFrontEndType === "screen"}
<CurrentItemPreview />
{:else if $store.currentFrontEndType === "page"}
<PageView />
{/if}
2019-07-30 09:31:07 +02:00
</div>
{#if $store.currentFrontEndType === "screen"}
<div class="components-pane">
<ComponentsPaneSwitcher />
</div>
2019-09-03 13:12:24 +02:00
{/if}
2019-07-26 18:08:59 +02:00
</div>
2019-07-13 11:35:57 +02:00
2019-08-16 16:48:45 +02:00
<NewComponent bind:this={newComponentPicker}/>
2019-08-19 22:18:23 +02:00
<SettingsView bind:this={settingsView} />
2019-07-13 11:35:57 +02:00
<style>
2019-07-26 18:08:59 +02:00
.root {
display: grid;
grid-template-columns: 290px 1fr 300px;
2019-07-30 09:31:07 +02:00
height: 100%;
2019-07-31 09:09:04 +02:00
width: 100%;
background: #fafafa;
2019-07-30 09:31:07 +02:00
}
.ui-nav {
grid-column: 1;
background-color: var(--secondary5);
2019-08-04 23:21:16 +02:00
height: 100%;
padding: 0 1.5rem 0rem 1.5rem
2019-07-30 09:31:07 +02:00
}
.preview-pane {
grid-column: 2;
margin: 80px 60px;
background: #fff;
border-radius: 5px;
box-shadow: 0 0px 6px rgba(0,0,0,0.05)
}
.components-pane {
grid-column: 3;
background-color: var(--secondary5);
min-height: 0px;
2019-09-20 10:02:22 +02:00
overflow-y: hidden;
}
2019-08-04 23:21:16 +02:00
.pages-list-container {
padding-top: 2rem;
}
.components-nav-header {
font-size: .9rem;
}
.nav-group-header {
font-size: .9rem;
padding-left: 1rem;
}
.nav-items-container {
padding: 1rem 1rem 0rem 1rem;
}
.nav-group-header {
display:grid;
grid-template-columns: [icon] auto [title] 1fr [button] auto;
padding: 2rem 0 0 0;
font-size: .9rem;
font-weight: bold;
}
.nav-group-header>div:nth-child(1) {
padding: 0rem .5rem 0rem 0rem;
vertical-align: bottom;
grid-column-start: icon;
margin-right: 5px;
}
.nav-group-header>span:nth-child(2) {
2019-08-04 23:21:16 +02:00
margin-left:5px;
vertical-align: bottom;
grid-column-start: title;
margin-top:auto;
2019-08-04 23:21:16 +02:00
}
.nav-group-header>div:nth-child(3) {
vertical-align: bottom;
grid-column-start: button;
cursor: pointer;
color: var(--primary75);
}
.nav-group-header>div:nth-child(3):hover {
color: var(--primary75);
}
</style>