peer-at-code-web/src/lib/components/layout/sidenav/sidenav-link.svelte
2024-04-06 01:08:27 +02:00

28 lines
628 B
Svelte

<script lang="ts">
import ArrowUpRight from 'lucide-svelte/icons/arrow-up-right';
import type { HTMLAnchorAttributes } from 'svelte/elements';
import { cn } from '$lib/utils';
type $$Props = HTMLAnchorAttributes & {
external?: boolean;
};
let className: string | undefined | null = undefined;
export { className as class };
export let href: $$Props['href'] = '';
export let external = false;
</script>
<a
{href}
target={external ? '_blank' : undefined}
class={cn(external && 'flex items-center gap-0.5', className)}
{...$$restProps}
>
<slot />
{#if external}
<ArrowUpRight class="h-3 w-3" />
{/if}
</a>