Fix more stuff, particularly event handlers

This commit is contained in:
Jon Staab
2025-02-03 17:21:46 -08:00
parent 8d3433b167
commit 24045a7e2a
150 changed files with 424 additions and 392 deletions
+12 -4
View File
@@ -2,7 +2,15 @@
import {page} from "$app/stores"
import Button from "@lib/components/Button.svelte"
let {title = "", href = "", prefix = "", notification = false, ...restProps} = $props()
const {
children,
onclick = undefined,
title = "",
href = "",
prefix = "",
notification = false,
...restProps
} = $props()
const active = $derived($page.url?.pathname?.startsWith(prefix || href || "bogus"))
</script>
@@ -14,20 +22,20 @@
class:bg-base-300={active}
class:tooltip={title}
data-tip={title}>
<slot />
{@render children?.()}
{#if !active && notification}
<div class="absolute right-2 top-2 h-2 w-2 rounded-full bg-primary"></div>
{/if}
</div>
</a>
{:else}
<Button on:click class="relative z-nav-item flex h-14 w-14 items-center justify-center">
<Button {onclick} class="relative z-nav-item flex h-14 w-14 items-center justify-center">
<div
class="avatar cursor-pointer rounded-full p-1 {restProps.class} transition-colors hover:bg-base-300"
class:bg-base-300={active}
class:tooltip={title}
data-tip={title}>
<slot />
{@render children?.()}
{#if !active && notification}
<div class="absolute right-2 top-2 h-2 w-2 rounded-full bg-primary"></div>
{/if}