import { AnchorHTMLAttributes, ButtonHTMLAttributes, DetailedHTMLProps, HTMLAttributeAnchorTarget, HTMLAttributes, } from "react"; import { ClassNameValue, twMerge } from "tailwind-merge"; export default function Button({ href, target, variant, color, linkProps, ...props }: DetailedHTMLProps< ButtonHTMLAttributes, HTMLButtonElement > & { variant?: "normal" | "ghost" | "outlined"; color?: "primary" | "secondary" | "accent"; href?: string; target?: HTMLAttributeAnchorTarget; linkProps?: DetailedHTMLProps< AnchorHTMLAttributes, HTMLAnchorElement >; }) { const finalClassName: string = (() => { if (variant == "normal" || !variant) { if (color == "primary" || !color) return "bg-blue-500 text-white"; } else if (variant == "outlined") { if (color == "primary" || !color) return ( "bg-transparent outline outline-1 outline-blue-500" + " text-blue-500" ); } else if (variant == "ghost") { } return ""; })(); const buttonComponent = ( ); if (href) return ( {buttonComponent} ); return buttonComponent; }