summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/ui/link.tsx
blob: a75a059ecb2da008f7f38fc5339a6fe1ba28ae96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { A } from "@solidjs/router"
import { splitProps } from "solid-js"
import type { ComponentProps } from "solid-js"
import { getButtonClasses } from "./button"

export interface LinkProps extends ComponentProps<typeof A> {
  variant?: "primary" | "secondary" | "outline" | "ghost"
  size?: "sm" | "md" | "lg"
}

export function Link(props: LinkProps) {
  const [local, others] = splitProps(props, ["variant", "size", "class"])
  const classes = local.variant ? getButtonClasses(local.variant, local.size, local.class) : local.class
  return <A class={classes} {...others} />
}