import classnames from 'classnames'; import type { ButtonHTMLAttributes, ComponentPropsWithoutRef, ElementType, ForwardedRef, } from 'react'; import { forwardRef } from 'react'; import { Icon } from './Icon'; const colorStyles = { default: 'hover:bg-gray-500/10 text-gray-600', gray: 'text-gray-800 bg-gray-50 hover:bg-gray-500/20', primary: 'bg-blue-400', secondary: 'bg-violet-400', warning: 'bg-orange-400', danger: 'bg-red-400', }; export type ButtonProps = ButtonHTMLAttributes & { color?: keyof typeof colorStyles; size?: 'xs' | 'sm' | 'md'; justify?: 'start' | 'center'; forDropdown?: boolean; as?: T; }; export const Button = forwardRef(function Button( { className, as, justify = 'center', children, size = 'md', forDropdown, color, ...props }: ButtonProps & Omit, keyof ButtonProps>, ref: ForwardedRef, ) { const Component = as || 'button'; return ( {children} {forDropdown && } ); });