2021-07-17 22:29:12 +03:00
|
|
|
<script>
|
|
|
|
|
export let tabs = [];
|
|
|
|
|
export let currentTab;
|
|
|
|
|
export let onChange;
|
|
|
|
|
</script>
|
|
|
|
|
|
2021-07-25 17:44:11 +03:00
|
|
|
<div class="w-full flex justify-center flex-col">
|
2021-07-17 22:29:12 +03:00
|
|
|
<div class="flex items-center">
|
|
|
|
|
{#each tabs as tab}
|
|
|
|
|
<button
|
|
|
|
|
class="relative border-r-1 border-t-0 border-b-0 border-l-0 rounded-none {currentTab ===
|
|
|
|
|
tab.value
|
|
|
|
|
? 'text-black font-bold bg-gray-100'
|
|
|
|
|
: 'bg-gray-200 text-gray'} focus:outline-none w-40 text-left p-3"
|
|
|
|
|
on:click={onChange(tab.value)}
|
|
|
|
|
>
|
|
|
|
|
{tab.label}
|
|
|
|
|
|
|
|
|
|
{#if currentTab === tab.value}
|
|
|
|
|
<span class="absolute w-full top-0 left-0 h-1 bg-blue-500" />
|
|
|
|
|
{/if}
|
|
|
|
|
</button>
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
|
|
|
|
|
2021-07-25 17:44:11 +03:00
|
|
|
<div class="mt-4">
|
|
|
|
|
<slot name="content" />
|
|
|
|
|
</div>
|
2021-07-17 22:29:12 +03:00
|
|
|
</div>
|