SPB Git forge

spb/uqo-chat

Public
14commits 1branches 0releases
1.4 MBsize
maindefault branch
17 days agolast push
Python 64.6% TypeScript 33.7% CSS 0.8%
1.4 KB · 44 lines tsx
Raw Blame History
1import { forwardRef, type ButtonHTMLAttributes } from 'react';2import { cn } from '@/lib/cn';34type Variant = 'primary' | 'secondary' | 'ghost' | 'danger' | 'accent';5type Size = 'sm' | 'md' | 'lg' | 'icon';67const variants: Record<Variant, string> = {8  primary: 'bg-uqo-blue text-white hover:bg-uqo-blue-dark disabled:bg-uqo-blue/50',9  secondary: 'bg-uqo-blue-light text-uqo-blue-dark hover:bg-[#d8e5f0]',10  ghost: 'bg-transparent text-neutral-text hover:bg-neutral-surface',11  danger: 'bg-semantic-error text-white hover:bg-[#a30d26]',12  accent: 'bg-uqo-green text-white hover:bg-[#67a51b]',13};14const sizes: Record<Size, string> = {15  sm: 'h-9 px-3 text-sm rounded-lg',16  md: 'h-11 px-4 text-sm rounded-xl',17  lg: 'h-12 px-5 text-base rounded-xl',18  icon: 'h-11 w-11 rounded-xl',19};2021export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {22  variant?: Variant;23  size?: Size;24}2526export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(27  { className, variant = 'primary', size = 'md', type = 'button', ...props },28  ref,29) {30  return (31    <button32      ref={ref}33      type={type}34      className={cn(35        'inline-flex items-center justify-center gap-2 font-medium transition-colors select-none disabled:cursor-not-allowed disabled:opacity-60 min-h-[44px] min-w-[44px]',36        variants[variant],37        sizes[size],38        className,39      )}40      {...props}41    />42  );43});44