"use client"

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

import { buttonVariants } from "./variants"

import type { ButtonProps } from "./button"

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