forked from coracle/flotilla
Fix more stuff, particularly event handlers
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
import {fade} from "@lib/transition"
|
||||
import {page} from "$app/stores"
|
||||
|
||||
let {href = "", notification = "false", ...restProps} = $props()
|
||||
const {children, href = "", notification = false, ...restProps} = $props()
|
||||
|
||||
const active = $derived($page.url.pathname === href)
|
||||
</script>
|
||||
@@ -33,11 +33,10 @@
|
||||
<a
|
||||
{...restProps}
|
||||
{href}
|
||||
on:click
|
||||
class="{restProps.class} relative flex items-center gap-3 text-left transition-all hover:bg-base-100 hover:text-base-content"
|
||||
class:text-base-content={active}
|
||||
class:bg-base-100={active}>
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
{#if !active && notification}
|
||||
<div class="absolute right-2 top-5 h-2 w-2 rounded-full bg-primary" transition:fade></div>
|
||||
{/if}
|
||||
@@ -45,13 +44,12 @@
|
||||
{:else}
|
||||
<button
|
||||
{...restProps}
|
||||
on:click
|
||||
class="{restProps.class} relative flex w-full items-center gap-3 text-left transition-all hover:bg-base-100 hover:text-base-content"
|
||||
class:text-base-content={active}
|
||||
class:bg-base-100={active}>
|
||||
{#if !active && notification}
|
||||
<div class="absolute right-2 top-5 h-2 w-2 rounded-full bg-primary" transition:fade></div>
|
||||
{/if}
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user