refactor: simplify ContentLinkUrl rendering
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user