2023-02-27 06:18:16 +00:00
|
|
|
<script lang="ts">
|
2024-12-09 05:26:51 +00:00
|
|
|
import { ExternalLink,type Icon as IconType } from 'lucide-svelte';
|
|
|
|
|
|
2024-12-04 17:37:49 +00:00
|
|
|
interface Props {
|
|
|
|
|
rel?: string;
|
|
|
|
|
target?: string;
|
|
|
|
|
href: string;
|
|
|
|
|
ariaLabel: string;
|
|
|
|
|
showIcon?: boolean;
|
|
|
|
|
clazz?: string;
|
2024-12-09 05:26:51 +00:00
|
|
|
icon?: typeof IconType | string;
|
2024-12-04 17:37:49 +00:00
|
|
|
children?: import('svelte').Snippet;
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-09 05:26:51 +00:00
|
|
|
let { rel = 'noreferrer', target = '_blank', href, ariaLabel, showIcon = false, clazz = '', icon = ExternalLink, children }: Props = $props();
|
2023-02-27 06:18:16 +00:00
|
|
|
</script>
|
|
|
|
|
|
2023-11-12 22:57:07 +00:00
|
|
|
|
2023-12-15 23:13:59 +00:00
|
|
|
<a class:show-icon={showIcon} class={clazz} aria-label={`Open ${ariaLabel} externally`} title={`Open ${ariaLabel} externally`} {href} {rel} {target}>
|
2024-12-04 17:37:49 +00:00
|
|
|
{@render children?.()}
|
2023-02-27 06:18:16 +00:00
|
|
|
{#if showIcon}
|
2024-12-09 05:26:51 +00:00
|
|
|
{#if typeof icon === 'string'}
|
|
|
|
|
{@html icon}
|
|
|
|
|
{:else}
|
|
|
|
|
{@const Icon = icon}
|
|
|
|
|
<Icon />
|
|
|
|
|
{/if}
|
2023-02-27 06:18:16 +00:00
|
|
|
{/if}
|
2023-11-12 22:57:07 +00:00
|
|
|
</a>
|
2023-02-27 06:18:16 +00:00
|
|
|
|
|
|
|
|
<style lang="postcss">
|
2024-05-15 00:33:39 +00:00
|
|
|
a {
|
|
|
|
|
margin: 1rem 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
font-size: var(--bodyTextSize);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-27 06:18:16 +00:00
|
|
|
.show-icon {
|
2023-02-28 23:42:00 +00:00
|
|
|
display: inline-flex;
|
2023-04-17 19:02:41 +00:00
|
|
|
align-items: center;
|
2023-02-27 06:18:16 +00:00
|
|
|
gap: 0.5rem;
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
color: var(--shellYellow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|