2020-05-29 14:28:12 +02:00
|
|
|
<script>
|
|
|
|
export let tabs = []
|
|
|
|
export const selectTab = tabName => {
|
|
|
|
selected = tabName
|
|
|
|
selectedIndex = tabs.indexOf(selected)
|
|
|
|
}
|
|
|
|
|
|
|
|
let selected = tabs.length > 0 && tabs[0]
|
|
|
|
let selectedIndex = 0
|
|
|
|
|
|
|
|
const isSelected = tab => selected === tab
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="root">
|
|
|
|
|
|
|
|
<div class="switcher">
|
|
|
|
|
|
|
|
{#each tabs as tab}
|
2020-05-29 19:32:52 +02:00
|
|
|
<button class:selected={selected === tab} on:click={() => selectTab(tab)}>
|
2020-05-29 14:28:12 +02:00
|
|
|
{tab}
|
|
|
|
</button>
|
|
|
|
{/each}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="panel">
|
|
|
|
{#if selectedIndex === 0}
|
2020-05-29 19:32:52 +02:00
|
|
|
<slot name="0" />
|
2020-05-29 14:28:12 +02:00
|
|
|
{:else if selectedIndex === 1}
|
2020-05-29 19:32:52 +02:00
|
|
|
<slot name="1" />
|
2020-05-29 14:28:12 +02:00
|
|
|
{:else if selectedIndex === 2}
|
2020-05-29 19:32:52 +02:00
|
|
|
<slot name="2" />
|
2020-05-29 14:28:12 +02:00
|
|
|
{:else if selectedIndex === 3}
|
2020-05-29 19:32:52 +02:00
|
|
|
<slot name="3" />
|
2020-05-29 14:28:12 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.root {
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
padding: 20px 20px;
|
2020-06-23 09:19:16 +02:00
|
|
|
border-left: solid 1px var(--grey-2);
|
2020-06-01 23:11:55 +02:00
|
|
|
box-sizing: border-box;
|
2020-05-29 14:28:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.switcher {
|
|
|
|
display: flex;
|
|
|
|
margin: 0px 20px 20px 0px;
|
2020-06-01 23:11:55 +02:00
|
|
|
box-sizing: border-box;
|
2020-05-29 14:28:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.switcher > button {
|
|
|
|
display: inline-block;
|
|
|
|
border: none;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
cursor: pointer;
|
|
|
|
font-size: 18px;
|
2020-06-23 09:19:16 +02:00
|
|
|
font-weight: 600;
|
|
|
|
color: var(--grey-5);
|
2020-05-29 14:28:12 +02:00
|
|
|
margin-right: 20px;
|
2020-06-01 23:16:12 +02:00
|
|
|
background: none;
|
2020-06-23 09:19:16 +02:00
|
|
|
outline: none;
|
2020-07-14 15:52:11 +02:00
|
|
|
font-family: Inter;
|
2020-05-29 14:28:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.switcher > .selected {
|
|
|
|
color: var(--ink);
|
|
|
|
}
|
2020-06-02 12:40:33 +02:00
|
|
|
|
2020-06-01 23:11:55 +02:00
|
|
|
.panel {
|
|
|
|
min-height: 0;
|
2020-06-02 12:12:36 +02:00
|
|
|
height: 100%;
|
2020-06-01 23:11:55 +02:00
|
|
|
overflow-y: auto;
|
|
|
|
}
|
2020-05-29 14:28:12 +02:00
|
|
|
</style>
|