import type { FC, PropsWithChildren } from "hono/jsx";

type ButtonVariant = "primary" | "secondary" | "danger";

interface ButtonProps {
  variant: ButtonVariant;
  href?: string;
  type?: "button" | "submit" | "reset";
}

export const Button: FC<PropsWithChildren<ButtonProps>> = ({
  variant,
  href,
  type = "button",
  children,
}) => {
  const classes = `btn btn-${variant}`;
  if (href) {
    return <a href={href} class={classes}>{children}</a>;
  }
  return <button type={type} class={classes}>{children}</button>;
};
