~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0
56 lines · 1.1 KB Raw History
<script lang="ts" module>
	// Lucide icons, drawn from their nodes: one icon wherever people act and
	// go, and a table's check, which has a `label` as its accessible name.
	import {
		ArrowLeft,
		Check,
		ChevronRight,
		ExternalLink,
		Globe,
		KeyRound,
		Monitor,
		User,
		UserPlus
	} from 'lucide';

	const icons = {
		'arrow-left': ArrowLeft,
		check: Check,
		'chevron-right': ChevronRight,
		'device-desktop': Monitor,
		globe: Globe,
		key: KeyRound,
		'link-external': ExternalLink,
		person: User,
		'person-add': UserPlus
	};

	export type IconName = keyof typeof icons;
</script>

<script lang="ts">
	let { name, size = 16, label }: { name: IconName; size?: number; label?: string } = $props();
</script>

<svg
	class="icon"
	viewBox="0 0 24 24"
	width={size}
	height={size}
	fill="none"
	stroke="currentColor"
	stroke-width="2"
	stroke-linecap="round"
	stroke-linejoin="round"
	role={label ? 'img' : undefined}
	aria-label={label}
	aria-hidden={label ? undefined : 'true'}
	focusable="false"
	>{#each icons[name] as [tag, attrs], i (i)}<svelte:element this={tag} {...attrs} />{/each}</svg
>

<style>
	.icon {
		flex: none;
	}
</style>