import type { ButtonHTMLAttributes, ReactNode } from "react"

export interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
  children: ReactNode
  variant?: "ghost" | "subtle" | "danger"
  size?: "sm" | "md"
}

export function IconButton({
  children,
  variant = "ghost",
  size = "md",
  className,
  type = "button",
  ...props
}: IconButtonProps) {
  const classes = [
    "icon-button",
    `icon-button-${variant}`,
    `icon-button-${size}`,
    className
  ].filter(Boolean).join(" ")

  return (
    <button type={type} className={classes} {...props}>
      {children}
    </button>
  )
}
