2020-01-18 00:06:42 +01:00
|
|
|
<script>
|
2020-02-10 16:51:09 +01:00
|
|
|
import { store } from "../builderStore/"
|
2020-02-18 16:41:44 +01:00
|
|
|
import ComponentPropertiesPanel from "./ComponentPropertiesPanel.svelte"
|
|
|
|
import ComponentSelectionList from "./ComponentSelectionList.svelte"
|
2020-01-18 00:06:42 +01:00
|
|
|
|
2020-02-25 00:23:33 +01:00
|
|
|
const PROPERTIES_TAB = "properties";
|
|
|
|
const COMPONENT_SELECTION_TAB = "components";
|
|
|
|
|
|
|
|
let selected = PROPERTIES_TAB
|
2020-01-18 00:06:42 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
const isSelected = tab => selected === tab
|
2020-01-18 00:06:42 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
const selectTab = tab => (selected = tab)
|
2020-02-25 00:23:33 +01:00
|
|
|
|
|
|
|
const toggleTab = () => selected = selected === PROPERTIES_TAB ? COMPONENT_SELECTION_TAB : PROPERTIES_TAB;
|
2020-01-18 00:06:42 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="root">
|
2020-02-10 16:51:09 +01:00
|
|
|
{#if $store.currentFrontEndType === 'page' || $store.screens.length}
|
|
|
|
<div class="switcher">
|
|
|
|
|
|
|
|
<button
|
2020-02-25 00:23:33 +01:00
|
|
|
class:selected={selected === PROPERTIES_TAB}
|
|
|
|
on:click={() => selectTab(PROPERTIES_TAB)}>
|
2020-02-10 16:51:09 +01:00
|
|
|
Properties
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button
|
2020-02-25 00:23:33 +01:00
|
|
|
class:selected={selected === COMPONENT_SELECTION_TAB}
|
|
|
|
on:click={() => selectTab(COMPONENT_SELECTION_TAB)}>
|
2020-02-10 16:51:09 +01:00
|
|
|
Components
|
|
|
|
</button>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="panel">
|
2020-02-25 00:23:33 +01:00
|
|
|
{#if selected === PROPERTIES_TAB}
|
|
|
|
<ComponentPropertiesPanel {toggleTab} />
|
2020-02-10 16:51:09 +01:00
|
|
|
{/if}
|
|
|
|
|
2020-02-25 00:23:33 +01:00
|
|
|
{#if selected === COMPONENT_SELECTION_TAB}
|
|
|
|
<ComponentSelectionList {toggleTab} />
|
2020-02-10 16:51:09 +01:00
|
|
|
{/if}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
{:else}
|
|
|
|
<p>Please create a new screen</p>
|
|
|
|
{/if}
|
2020-01-18 00:06:42 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
2020-02-03 10:50:30 +01:00
|
|
|
.root {
|
2020-01-18 00:06:42 +01:00
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2020-01-20 18:13:58 +01:00
|
|
|
padding: 2rem 1.5rem 2rem 1.5rem;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-18 00:06:42 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.switcher {
|
2020-01-20 18:13:58 +01:00
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
2020-01-21 15:50:35 +01:00
|
|
|
margin-bottom: 25px;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-18 00:06:42 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.switcher > button {
|
2020-01-18 00:06:42 +01:00
|
|
|
display: inline-block;
|
2020-01-20 18:13:58 +01:00
|
|
|
border: none;
|
2020-01-21 15:50:35 +01:00
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
2020-01-18 00:06:42 +01:00
|
|
|
cursor: pointer;
|
2020-01-20 18:13:58 +01:00
|
|
|
font-weight: 600;
|
|
|
|
font-size: 0.85rem;
|
|
|
|
text-transform: uppercase;
|
|
|
|
color: #999;
|
2020-02-03 10:50:30 +01:00
|
|
|
background-color: rgba(0, 0, 0, 0);
|
|
|
|
}
|
2020-01-18 00:06:42 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.switcher > .selected {
|
2020-01-20 18:13:58 +01:00
|
|
|
color: #333;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-18 00:06:42 +01:00
|
|
|
|
2020-02-03 10:50:30 +01:00
|
|
|
.panel {
|
2020-01-18 00:06:42 +01:00
|
|
|
flex: 1 1 auto;
|
|
|
|
height: 0px;
|
|
|
|
overflow-y: auto;
|
2020-02-03 10:50:30 +01:00
|
|
|
}
|
2020-01-20 18:13:58 +01:00
|
|
|
</style>
|