import { motion } from "motion/react" import { forwardRef } from "react" import type { ComponentPropsWithoutRef } from "react" type ButtonVariant = "primary" | "secondary" | "ghost" type ButtonSize = "sm" | "md" | "lg" interface ButtonProps extends ComponentPropsWithoutRef<"button"> { variant?: ButtonVariant size?: ButtonSize href?: string download?: boolean children: React.ReactNode } const variantClasses: Record = { primary: "btn btn-primary", secondary: "btn btn-secondary", ghost: "btn btn-ghost", } const sizeClasses: Record = { sm: "btn-sm", md: "", lg: "btn-lg", } export const Button = forwardRef< HTMLButtonElement | HTMLAnchorElement, ButtonProps >( ( { variant = "primary", size = "md", href, className = "", children, ...props }, ref ) => { const classes = `${variantClasses[variant]} ${sizeClasses[size]} ${className}`.trim() if (href) { return ( } whileTap={{ scale: 0.95 }} {...(props as Omit, keyof ButtonProps>)} > {children} ) } return ( } whileTap={{ scale: 0.95 }} {...(props as Omit, keyof ButtonProps>)} > {children} ) } ) Button.displayName = "Button"