flotilla/src/lib/components/SecondaryNavItem.svelte

37 lines
764 B
Svelte
Raw Normal View History

2024-08-05 21:45:16 +00:00
<script lang="ts">
2024-08-06 22:46:37 +00:00
import {page} from "$app/stores"
2024-08-05 21:45:16 +00:00
export let href
2024-08-06 22:46:37 +00:00
$: active = $page.route.id?.startsWith(href)
2024-08-05 21:45:16 +00:00
</script>
2024-08-06 22:46:37 +00:00
<a
{href}
2024-08-08 21:02:46 +00:00
class="group justify-start border-none transition-all hover:bg-base-100"
2024-08-06 22:46:37 +00:00
class:text-stark-content={active}
class:bg-base-100={active}>
<div class="flex items-center gap-3">
2024-08-05 21:45:16 +00:00
<slot />
</div>
</a>
2024-08-08 21:02:46 +00:00
<style>
a {
padding: 12px 16px;
display: flex;
border-radius: var(--rounded-btn, 0.5rem);
cursor: pointer;
animation: nav-button-pop 200ms ease-out;
transition-property: all;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
transition-duration: 150ms;
}
a:active:hover,
a:active:focus {
animation: button-pop 0s ease-out;
transform: scale(var(--btn-focus-scale, 0.97));
}
</style>