summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/components/link.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'packages/app/src/components/link.tsx')
-rw-r--r--packages/app/src/components/link.tsx17
1 files changed, 13 insertions, 4 deletions
diff --git a/packages/app/src/components/link.tsx b/packages/app/src/components/link.tsx
index e13c31330..85f7efc53 100644
--- a/packages/app/src/components/link.tsx
+++ b/packages/app/src/components/link.tsx
@@ -1,17 +1,26 @@
import { ComponentProps, splitProps } from "solid-js"
import { usePlatform } from "@/context/platform"
-export interface LinkProps extends ComponentProps<"button"> {
+export interface LinkProps extends Omit<ComponentProps<"a">, "href"> {
href: string
}
export function Link(props: LinkProps) {
const platform = usePlatform()
- const [local, rest] = splitProps(props, ["href", "children"])
+ const [local, rest] = splitProps(props, ["href", "children", "class"])
return (
- <button class="text-text-strong underline" onClick={() => platform.openLink(local.href)} {...rest}>
+ <a
+ href={local.href}
+ class={`text-text-strong underline ${local.class ?? ""}`}
+ onClick={(event) => {
+ if (!local.href) return
+ event.preventDefault()
+ platform.openLink(local.href)
+ }}
+ {...rest}
+ >
{local.children}
- </button>
+ </a>
)
}