2021-07-17 22:29:12 +03:00
|
|
|
<script>
|
2023-08-10 14:25:44 +01:00
|
|
|
import TextChip from '$lib/components/Chip/Text.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">
|
2023-08-10 00:35:45 +01:00
|
|
|
<div class="flex items-center border-b-2 w-full">
|
2021-07-17 22:29:12 +03:00
|
|
|
{#each tabs as tab}
|
|
|
|
|
<button
|
2023-08-09 16:00:54 +01:00
|
|
|
class="relative {currentTab === tab.value
|
2023-08-10 00:35:45 +01:00
|
|
|
? 'text-blue-500 dark:bg-gray-700'
|
2023-08-10 14:25:44 +01:00
|
|
|
: 'dark:bg-gray-500 text-black'} font-semibold focus:outline-none w-24 text-left py-3 mr-10"
|
2021-07-17 22:29:12 +03:00
|
|
|
on:click={onChange(tab.value)}
|
|
|
|
|
>
|
2023-08-10 14:25:44 +01:00
|
|
|
<div class="grid grid-cols-4 gap-3 items-center">
|
|
|
|
|
{#if tab.icon}
|
|
|
|
|
<svelte:component this={tab.icon} />
|
|
|
|
|
{/if}
|
2023-08-10 12:50:53 +01:00
|
|
|
{tab.label}
|
2023-08-10 14:25:44 +01:00
|
|
|
{#if typeof tab.badgeValue === 'number'}
|
|
|
|
|
<TextChip
|
|
|
|
|
value={tab.badgeValue}
|
|
|
|
|
size="sm"
|
|
|
|
|
shape="rounded-full"
|
|
|
|
|
className=" bg-gray-300 dark:text-black text-xs absolute right-0 px-2"
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
2023-08-10 12:50:53 +01:00
|
|
|
</div>
|
|
|
|
|
|
2023-08-10 08:23:22 +01:00
|
|
|
<span
|
2023-08-10 08:47:24 +01:00
|
|
|
class="absolute bottom-0 left-0 h-1 bg-blue-500 rounded-md transition-all ease-in-out duration-500 {currentTab ===
|
2023-08-10 08:23:22 +01:00
|
|
|
tab.value
|
|
|
|
|
? 'w-full'
|
|
|
|
|
: 'w-0'}"
|
|
|
|
|
/>
|
2021-07-17 22:29:12 +03:00
|
|
|
</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>
|