link.tsx 481 B

1234567891011121314151617
  1. import { ComponentProps, splitProps } from "solid-js"
  2. import { usePlatform } from "@/context/platform"
  3. export interface LinkProps extends ComponentProps<"button"> {
  4. href: string
  5. }
  6. export function Link(props: LinkProps) {
  7. const platform = usePlatform()
  8. const [local, rest] = splitProps(props, ["href", "children"])
  9. return (
  10. <button class="text-text-strong underline" onClick={() => platform.openLink(local.href)} {...rest}>
  11. {local.children}
  12. </button>
  13. )
  14. }