Coves frontend - a photon fork
at main 43 lines 794 B view raw
1<script lang="ts" module> 2 export const parseURL = (href: string) => { 3 try { 4 return new URL(href) 5 } catch { 6 return undefined 7 } 8 } 9</script> 10 11<script lang="ts"> 12 import type { HTMLAnchorAttributes } from 'svelte/elements' 13 14 interface Props extends HTMLAnchorAttributes { 15 href: string 16 highlight?: boolean 17 children?: import('svelte').Snippet 18 class?: string 19 icon?: import('svelte').Snippet 20 } 21 22 let { 23 href, 24 highlight = false, 25 children, 26 class: clazz = '', 27 icon, 28 ...rest 29 }: Props = $props() 30</script> 31 32<a 33 {...rest} 34 {href} 35 class={[ 36 'hover:underline max-w-full inline-flex items-center gap-1', 37 highlight && 'text-blue-600 dark:text-blue-400', 38 clazz, 39 ]} 40> 41 {@render icon?.()} 42 {@render children?.()} 43</a>