refactor: simplify ContentLinkUrl rendering

This commit is contained in:
2026-04-11 18:56:23 +05:30
parent ebc1e72b28
commit bdc7d9e070
3 changed files with 14 additions and 24 deletions
+2 -15
View File
@@ -1,5 +1,4 @@
<script lang="ts">
import type {Snippet} from "svelte"
import {call, displayUrl} from "@welshman/lib"
import {displayRelayUrl, isRelayUrl, normalizeRelayUrl} from "@welshman/util"
import LinkRound from "@assets/icons/link-round.svg?dataurl"
@@ -9,17 +8,11 @@
import {makeRoomPath, makeSpacePath} from "@app/util/routes"
const {
children,
url,
class: className = "",
showIcon = false,
labelClass = "",
}: {
children?: Snippet
url: string
class?: string
showIcon?: boolean
labelClass?: string
} = $props()
const roomReference = call(() => {
@@ -69,12 +62,6 @@
</script>
<Link {external} {href} class={className}>
{#if children}
{@render children()}
{:else if showIcon}
<Icon icon={LinkRound} size={3} class="inline-block" />
<span class={labelClass}>{label}</span>
{:else}
{label}
{/if}
<Icon icon={LinkRound} size={3} class="inline-block" />
<span class="ml-2">{label}</span>
</Link>