summaryrefslogtreecommitdiff
path: root/ping/frontend/src/lib/components/Button.svelte
blob: 54b26abb17b318c48a4315cc2eb28c1a3b5560af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<script lang="ts">
	// Accept props and ensure onclick matches the expected event handler signature
	const {
		href = undefined as string | undefined,
		onclick = undefined as
			| ((event: MouseEvent & { currentTarget: EventTarget & HTMLButtonElement }) => void)
			| undefined,
		disabled = false,
		children
	} = $props();
</script>

{#if href}
	<a class="btn" {href}>{@render children?.()}</a>
{:else}
	<button class="btn" {onclick} {disabled}>{@render children?.()}</button>
{/if}