2021-07-17 22:29:12 +03:00
|
|
|
<script>
|
2021-08-31 21:59:17 +03:00
|
|
|
import Chip from '../Chip/index.svelte';
|
2021-07-17 22:29:12 +03:00
|
|
|
export let tabs = [];
|
|
|
|
|
export let currentTab;
|
|
|
|
|
export let onChange;
|
|
|
|
|
</script>
|
|
|
|
|
|
2021-08-18 19:47:02 +03:00
|
|
|
<div class="w-full flex flex-col">
|
|
|
|
|
<div class="flex items-center justify-center">
|
2021-07-17 22:29:12 +03:00
|
|
|
{#each tabs as tab}
|
|
|
|
|
<button
|
|
|
|
|
class="relative border-r-1 border-t-0 border-b-0 border-l-0 rounded-none {currentTab ===
|
|
|
|
|
tab.value
|
2023-05-05 20:19:45 +00:00
|
|
|
? 'text-black font-bold bg-gray-100 dark:bg-gray-700'
|
|
|
|
|
: 'bg-gray-200 dark:bg-gray-500 text-gray'} focus:outline-none w-40 text-left p-3"
|
2021-07-17 22:29:12 +03:00
|
|
|
on:click={onChange(tab.value)}
|
|
|
|
|
>
|
|
|
|
|
{tab.label}
|
2021-08-31 21:59:17 +03:00
|
|
|
{#if typeof tab.badgeValue === 'number'}
|
2023-08-05 04:44:32 +01:00
|
|
|
<Chip value={tab.badgeValue} className="ml-1 bg-gray-300 dark:text-black" />
|
2021-08-31 21:59:17 +03:00
|
|
|
{/if}
|
2021-07-17 22:29:12 +03:00
|
|
|
|
|
|
|
|
{#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>
|