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

83 lines
1.4 KiB
Svelte
Raw Normal View History

<script>
import ComponentPanel from "./ComponentPanel.svelte";
import ComponentsList from "./ComponentsList.svelte";
let selected="properties";
const isSelected = tab =>
selected === tab;
const selectTab = tab =>
selected = tab;
</script>
<div class="root">
<div class="switcher">
<button
class:selected={selected==="properties"}
on:click={() => selectTab("properties")}>
Properties
</button>
<button
class:selected={selected==="components"}
on:click={() => selectTab("components")}>
Components
</button>
</div>
<div class="panel">
{#if selected==="properties"}
2020-01-21 15:50:35 +01:00
<ComponentPanel />
{/if}
{#if selected==="components"}
2020-01-21 15:50:35 +01:00
<ComponentsList />
{/if}
</div>
</div>
<style>
.root {
height: 100%;
display: flex;
flex-direction: column;
padding: 2rem 1.5rem 2rem 1.5rem;
}
.switcher {
display: flex;
justify-content: space-between;
2020-01-21 15:50:35 +01:00
margin-bottom: 25px;
}
.switcher > button {
display: inline-block;
border: none;
2020-01-21 15:50:35 +01:00
margin: 0;
padding: 0;
cursor: pointer;
font-weight: 600;
font-size: 0.85rem;
text-transform: uppercase;
color: #999;
}
.switcher > .selected {
color: #333;
}
.panel {
flex: 1 1 auto;
height: 0px;
overflow-y: auto;
}
</style>