2024-08-16 17:50:38 +00:00
|
|
|
<style>
|
|
|
|
|
a,
|
|
|
|
|
button {
|
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
display: flex;
|
2026-06-24 20:56:53 +00:00
|
|
|
border-radius: var(--radius-2xl);
|
2024-08-16 17:50:38 +00:00
|
|
|
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,
|
|
|
|
|
button:active:hover,
|
|
|
|
|
button:active:focus {
|
|
|
|
|
animation: button-pop 0s ease-out;
|
2026-06-24 20:56:53 +00:00
|
|
|
transform: scale(0.97);
|
2024-08-16 17:50:38 +00:00
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
2024-08-05 21:45:16 +00:00
|
|
|
<script lang="ts">
|
2026-04-06 16:08:02 +00:00
|
|
|
import cx from "classnames"
|
2024-11-14 18:53:13 +00:00
|
|
|
import {fade} from "@lib/transition"
|
2024-08-06 22:46:37 +00:00
|
|
|
import {page} from "$app/stores"
|
|
|
|
|
|
2026-09-08 17:23:22 +00:00
|
|
|
const {children, href = "", title = "", notification = false, ...restProps} = $props()
|
2024-08-06 22:46:37 +00:00
|
|
|
|
2025-02-04 00:37:14 +00:00
|
|
|
const active = $derived($page.url.pathname === href)
|
2026-04-06 16:08:02 +00:00
|
|
|
const wrapperClass = $derived(
|
2026-06-24 20:56:53 +00:00
|
|
|
cx(
|
|
|
|
|
restProps.class,
|
|
|
|
|
"secondary-nav__nav-item relative flex shrink-0 items-center gap-3 text-left transition-all",
|
|
|
|
|
{
|
|
|
|
|
"secondary-nav__nav-item--active": active,
|
|
|
|
|
"tip tip-right": title,
|
|
|
|
|
},
|
|
|
|
|
),
|
2026-04-06 16:08:02 +00:00
|
|
|
)
|
2024-08-05 21:45:16 +00:00
|
|
|
</script>
|
|
|
|
|
|
2024-08-16 17:50:38 +00:00
|
|
|
{#if href}
|
2026-09-08 17:23:22 +00:00
|
|
|
<a {href} {...restProps} data-tip={title} class={wrapperClass}>
|
2025-02-04 01:21:46 +00:00
|
|
|
{@render children?.()}
|
2026-02-27 20:25:16 +00:00
|
|
|
{#if notification}
|
2026-06-24 20:56:53 +00:00
|
|
|
<div
|
|
|
|
|
class="absolute right-[1.15rem] top-5 h-2 w-2 rounded-full bg-primary text-primary-content"
|
|
|
|
|
transition:fade>
|
2026-04-06 16:09:01 +00:00
|
|
|
</div>
|
2024-11-14 18:53:13 +00:00
|
|
|
{/if}
|
2024-08-16 17:50:38 +00:00
|
|
|
</a>
|
|
|
|
|
{:else}
|
2026-04-06 16:08:02 +00:00
|
|
|
<button {...restProps} data-tip={title} class={wrapperClass}>
|
2026-02-27 20:25:16 +00:00
|
|
|
{#if notification}
|
2026-06-24 20:56:53 +00:00
|
|
|
<div
|
|
|
|
|
class="absolute right-[1.15rem] top-5 h-2 w-2 rounded-full bg-primary text-primary-content"
|
|
|
|
|
transition:fade>
|
2026-04-06 16:09:01 +00:00
|
|
|
</div>
|
2024-11-14 18:53:13 +00:00
|
|
|
{/if}
|
2025-02-04 01:21:46 +00:00
|
|
|
{@render children?.()}
|
2024-08-16 17:50:38 +00:00
|
|
|
</button>
|
|
|
|
|
{/if}
|