summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/components/link.tsx
blob: e13c31330480d99d181cdf7b290ef69cefe0ef2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { ComponentProps, splitProps } from "solid-js"
import { usePlatform } from "@/context/platform"

export interface LinkProps extends ComponentProps<"button"> {
  href: string
}

export function Link(props: LinkProps) {
  const platform = usePlatform()
  const [local, rest] = splitProps(props, ["href", "children"])

  return (
    <button class="text-text-strong underline" onClick={() => platform.openLink(local.href)} {...rest}>
      {local.children}
    </button>
  )
}