/** * Button 组件 * * 统一的按钮组件,遵循三层架构设计 * 提供多种变体(primary、secondary、ghost、danger、success) * 支持多种尺寸(sm、md、lg)、加载状态、全宽等 * 使用 forwardRef 支持 ref 传递 * * @created 2025-11-22 * @component */ 'use client' import { ButtonHTMLAttributes, ReactNode, forwardRef } from 'react' import { useThemeStyles, cn } from '@/lib/ui-styles' interface ButtonProps extends ButtonHTMLAttributes { children: ReactNode variant?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'success' size?: 'sm' | 'md' | 'lg' fullWidth?: boolean loading?: boolean } const Button = forwardRef( ( { children, variant = 'primary', size = 'md', fullWidth = false, loading = false, disabled, className = '', ...props }, ref ) => { const styles = useThemeStyles() const sizeClasses = { sm: styles.buttonModifiers.compactXs, md: '', lg: 'px-8 py-4 text-base', } const variantClass = styles.buttonStyles[variant] return ( ) } ) Button.displayName = 'Button' export default Button