peer-at-code-web/src/lib/components/layout/sidenav/sidenav-link.svelte
2024-03-24 23:15:58 +01:00

28 lines
611 B
Svelte

<script lang="ts">
import { ArrowUpRight } from 'lucide-svelte';
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>