"use client"

import { Slot } from "@radix-ui/react-slot"

import { buttonVariants } from "./variants"

import type { ButtonProps } from "./button"

export default function Button({
  asChild = false,
  theme,
  className,
  disabled,
  intent,
  size,
  variant,
  ...props
}: ButtonProps) {
  const Comp = asChild ? Slot : "button"
  const classNames = buttonVariants({
    className,
    intent,
    size,
    theme,
    variant,
  })
  return <Comp className={classNames} disabled={disabled} {...props} />
}
