refactor: enhanced structure

This commit is contained in:
2025-11-28 20:57:24 +03:00
parent 9400c9d748
commit ffa6afc913
11 changed files with 268 additions and 292 deletions

View File

@@ -1,31 +1,27 @@
<!-- components/Tabs.svelte -->
<!-- src/components/Tabs.svelte -->
<script>
export let activeTab = 'overview';
export let tabs = [
{ id: 'overview', label: 'Overview' },
{ id: 'settings', label: 'Settings' }
];
import { activeTab, TABS } from '../stores/appStore';
</script>
<div class="tabs-container">
{#each tabs as tab}
<button
class="tab {activeTab === tab.id ? 'active' : ''}"
on:click={() => activeTab = tab.id}
>
{tab.label}
</button>
{/each}
{#each TABS as tab}
<button
class="tab {$activeTab === tab.id ? 'active' : ''}"
on:click={() => $activeTab = tab.id}
>
{tab.label}
</button>
{/each}
</div>
<style>
.tabs-container {
.tabs-container {
background-color: var(--bg-primary);
border-bottom: 1px solid var(--border-color);
display: flex;
}
}
.tab {
.tab {
flex: 1;
padding: var(--spacing-md) var(--spacing-lg);
background: transparent;
@@ -35,17 +31,17 @@ export let tabs = [
position: relative;
transition: color 0.2s ease;
font-size: 0.875rem;
}
}
.tab:hover {
.tab:hover {
color: var(--text-primary);
}
}
.tab.active {
.tab.active {
color: var(--text-primary);
}
}
.tab.active::after {
.tab.active::after {
content: '';
position: absolute;
bottom: 0;
@@ -53,5 +49,5 @@ export let tabs = [
right: 0;
height: 2px;
background-color: var(--accent-primary);
}
}
</style>