2023-02-27 06:18:16 +00:00
|
|
|
<script lang="ts">
|
|
|
|
|
import OpenInNew from '@iconify-icons/mdi/open-in-new';
|
2023-02-28 23:42:00 +00:00
|
|
|
import type { IconifyIcon } from 'iconify-icon';
|
2024-12-04 17:37:49 +00:00
|
|
|
interface Props {
|
|
|
|
|
rel?: string;
|
|
|
|
|
target?: string;
|
|
|
|
|
href: string;
|
|
|
|
|
ariaLabel: string;
|
|
|
|
|
showIcon?: boolean;
|
|
|
|
|
clazz?: string;
|
|
|
|
|
icon?: IconifyIcon;
|
|
|
|
|
children?: import('svelte').Snippet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
rel = 'noreferrer',
|
|
|
|
|
target = '_blank',
|
|
|
|
|
href,
|
|
|
|
|
ariaLabel,
|
|
|
|
|
showIcon = false,
|
|
|
|
|
clazz = "",
|
|
|
|
|
icon = OpenInNew,
|
|
|
|
|
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-04 17:37:49 +00:00
|
|
|
<iconify-icon {icon} width="24" height="24" role="img" title={`Open ${ariaLabel} Externally`}></iconify-icon>
|
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>
|