Skip to content

Commit

Permalink
Components aren't classes anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisSpomer committed Feb 6, 2025
1 parent 034d072 commit 2ed3582
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/lib/components/PostLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/** The ID of the post. */
export let postIndex: number | undefined
/** Optionally, child elements to render. */
export let children: NodeList | undefined = undefined
export let childNodes: NodeList | undefined = undefined
let isPopupOpen: boolean
let hasTriedLoading: boolean
Expand Down Expand Up @@ -56,7 +56,7 @@

{#if browser}
<Popup onHover={!errorLoading && !lockedOpen} bind:isOpen={isPopupOpen}>
<HoverLink slot="anchor" href={`/threads/${threadID}#Post${postIndex}`} childNodes={children} navigate={false} on:click={onClick} />
<HoverLink slot="anchor" href={`/threads/${threadID}#Post${postIndex}`} childNodes={childNodes} navigate={false} on:click={onClick} />
<PopupFrame style="HoverLink">
{#if post}
<PostView {post} readonly compact scrollIntoView={false} />
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/UserHtml.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@
}
</script>

<div bind:this={root} />
<div bind:this={root}></div>
19 changes: 11 additions & 8 deletions src/lib/components/upgradeLink.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { mount } from "svelte"

const specialLinkTypes: Record<string, any> = {}

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
Expand Down Expand Up @@ -42,14 +44,15 @@ export function upgradeLink(link: HTMLAnchorElement): void
const linkProps = parseLink(href)
if (linkProps)
{
new specialLinkTypes.PostLink({
target: link.parentElement!,
anchor: link,
props: {
...linkProps,
children: link.childNodes
},
})
mount(specialLinkTypes.PostLink,
{
target: link.parentElement!,
anchor: link,
props: {
...linkProps,
childNodes: link.childNodes
},
})
link.remove()
}
}
Expand Down

0 comments on commit 2ed3582

Please sign in to comment.