This commit is contained in:
2026-07-20 16:36:18 +02:00
parent ca24632fac
commit 7c62f8a8e8
5 changed files with 62 additions and 39 deletions
@@ -0,0 +1,39 @@
<script lang="ts">
import type { LucideIcon } from '@lucide/svelte';
interface Props {
icon: LucideIcon;
label: string;
href?: string;
type?: 'button' | 'submit';
reload?: boolean;
onclick?: (event: MouseEvent) => void;
class?: string;
}
let {
icon: Icon,
label,
href,
type = 'button',
reload = false,
onclick,
class: klass = ''
}: Props = $props();
const classes = $derived(
`flex w-full items-center gap-3 rounded-control px-2 py-2.5 text-left text-base text-fg-2 transition hover:bg-hover ${klass}`
);
</script>
{#if href}
<a {href} data-sveltekit-reload={reload ? '' : undefined} {onclick} class={classes}>
<Icon class="h-6 w-6 shrink-0" strokeWidth={2} />
{label}
</a>
{:else}
<button {type} {onclick} class={classes}>
<Icon class="h-6 w-6 shrink-0" strokeWidth={2} />
{label}
</button>
{/if}