Browse Source
Nostr-Signature: d34fb23385a23f479c683e76f5676356a11d63bcd0ecf71d25f1b85dbb0cfe57 573634b648634cbad10f2451776089ea21090d9407f715e83c577b4611ae6edc 1f6454f9961b9245d1e32f4a903ee9636201670491145d0185e95e7b7d33bf1027ac5b8e370070640e103740ab19e9915baa7755c6008fd32fe41e9cb86d33b8main
6 changed files with 313 additions and 77 deletions
@ -0,0 +1,59 @@ |
|||||||
|
<script lang="ts"> |
||||||
|
import '$lib/styles/components.css'; |
||||||
|
|
||||||
|
interface Props { |
||||||
|
activeTab: string; |
||||||
|
tabs: Array<{ id: string; label: string; icon?: string; count?: number }>; |
||||||
|
onTabChange: (tab: string) => void; |
||||||
|
} |
||||||
|
|
||||||
|
let { activeTab, tabs, onTabChange }: Props = $props(); |
||||||
|
let showTabsMenu = $state(false); |
||||||
|
</script> |
||||||
|
|
||||||
|
<div class="tabs-menu-button-wrapper"> |
||||||
|
<div class="menu-button-wrapper"> |
||||||
|
<button |
||||||
|
class="menu-button" |
||||||
|
onclick={() => showTabsMenu = !showTabsMenu} |
||||||
|
aria-label="Tabs menu" |
||||||
|
title="View tabs" |
||||||
|
> |
||||||
|
<img src="/icons/more-vertical.svg" alt="" class="icon" /> |
||||||
|
</button> |
||||||
|
{#if showTabsMenu} |
||||||
|
<div |
||||||
|
class="more-menu-overlay" |
||||||
|
onclick={() => showTabsMenu = false} |
||||||
|
onkeydown={(e) => { |
||||||
|
if (e.key === 'Escape') { |
||||||
|
showTabsMenu = false; |
||||||
|
} |
||||||
|
}} |
||||||
|
role="button" |
||||||
|
tabindex="0" |
||||||
|
aria-label="Close menu" |
||||||
|
></div> |
||||||
|
<div class="more-menu tabs-menu"> |
||||||
|
{#each tabs as tab} |
||||||
|
<button |
||||||
|
class="menu-item" |
||||||
|
class:active={activeTab === tab.id} |
||||||
|
onclick={() => { |
||||||
|
onTabChange(tab.id); |
||||||
|
showTabsMenu = false; |
||||||
|
}} |
||||||
|
> |
||||||
|
{#if tab.icon} |
||||||
|
<img src={tab.icon} alt="" class="tab-icon-inline" /> |
||||||
|
{/if} |
||||||
|
{tab.label} |
||||||
|
{#if tab.count !== undefined} |
||||||
|
<span class="tab-count-inline">{tab.count}</span> |
||||||
|
{/if} |
||||||
|
</button> |
||||||
|
{/each} |
||||||
|
</div> |
||||||
|
{/if} |
||||||
|
</div> |
||||||
|
</div> |
||||||
Loading…
Reference in new issue