<script lang="ts">
	// Wrapper um lucide-svelte mit fester Groesse + currentColor.
	// Nutzung:
	//   <Icon icon={FileText} size={16} />
	//   <Icon icon={Check} size="lg" />

	import type { Component } from 'svelte';

	interface Props {
		icon: Component<{ size?: number | string; color?: string; strokeWidth?: number; class?: string }>;
		size?: number | 'sm' | 'md' | 'lg';
		strokeWidth?: number;
		class?: string;
	}

	let { icon: IconComp, size = 16, strokeWidth = 2, class: className = '' }: Props = $props();

	const px = $derived.by(() => {
		if (typeof size === 'number') return size;
		if (size === 'sm') return 14;
		if (size === 'lg') return 20;
		return 16;
	});
</script>

<IconComp size={px} strokeWidth={strokeWidth} class={className} />
