cobalt/web/src/components/sidebar/SidebarTab.svelte

53 lines
1 KiB
Svelte
Raw Normal View History

2024-06-14 11:33:01 +01:00
<script lang="ts">
import { page } from "$app/stores";
export let tabName: string;
export let tabLink: string;
$: isTabActive = $page.url.pathname === tabLink;
</script>
<a
id="sidebar-tab-{tabName}"
class="sidebar-tab"
class:active={isTabActive}
href={tabLink}
>
<slot></slot>
{tabName}
</a>
<style>
.sidebar-tab {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
gap: 5px;
2024-06-14 16:48:57 +01:00
padding: var(--padding) 5px;
color: var(--primary);
2024-06-14 11:33:01 +01:00
font-size: var(--sidebar-font-size);
opacity: 0.8;
}
2024-06-14 11:38:10 +01:00
2024-06-14 11:33:01 +01:00
.sidebar-tab.active {
2024-06-14 16:48:57 +01:00
color: var(--secondary);
background: var(--primary);
2024-06-14 11:33:01 +01:00
opacity: 1;
}
2024-06-14 11:38:10 +01:00
2024-06-14 11:33:01 +01:00
.sidebar-tab:hover {
opacity: 1;
}
2024-06-14 12:33:33 +01:00
@media screen and (max-width: 535px) {
.sidebar-tab {
2024-06-14 16:48:57 +01:00
padding: 5px var(--padding);
2024-06-14 12:33:33 +01:00
min-width: calc(var(--sidebar-width) / 2);
}
.sidebar-tab.active {
z-index: 2;
}
}
2024-06-14 11:33:01 +01:00
</style>