Files
wishlist/src/lib/components/layout/EmptyState.svelte
T

46 lines
911 B
Svelte

<script lang="ts">
import { Button } from '$lib/components/ui/button';
import type { Snippet } from 'svelte';
let {
message,
description,
actionLabel,
actionHref,
onclick,
children
}: {
message: string;
description?: string;
actionLabel?: string;
actionHref?: string;
onclick?: () => void;
children?: Snippet;
} = $props();
</script>
<div class="text-center py-8 text-muted-foreground">
<p class="text-base">{message}</p>
{#if description}
<p class="text-sm mt-2">{description}</p>
{/if}
{#if children}
<div class="mt-4">
{@render children()}
</div>
{:else if actionLabel}
<Button
class="mt-4"
onclick={() => {
if (onclick) {
onclick();
} else if (actionHref) {
window.location.href = actionHref;
}
}}
>
{actionLabel}
</Button>
{/if}
</div>