<script lang="ts">
	import type { Snippet } from 'svelte';

	let {
		title = '暂无数据',
		description,
		action,
	}: {
		title?: string;
		description?: string;
		action?: Snippet;
	} = $props();
</script>

<div class="saas-empty">
	<div
		class="mb-1 flex h-12 w-12 items-center justify-center border border-surface-300 bg-surface-100 text-surface-600"
	>
		<svg class="h-6 w-6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75">
			<path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25H12" />
		</svg>
	</div>
	<p class="text-sm font-medium text-surface-900">{title}</p>
	{#if description}
		<p class="max-w-sm text-sm text-surface-600">{description}</p>
	{/if}
	{#if action}
		<div class="mt-2">
			{@render action()}
		</div>
	{/if}
</div>
