/** * Button 按钮组件 * 设计稿参考: UIDesignSpec.md 3.4 */ import React from 'react'; import { LucideIcon } from 'lucide-react'; export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'success' | 'ghost'; export type ButtonSize = 'sm' | 'md' | 'lg'; export interface ButtonProps extends React.ButtonHTMLAttributes { variant?: ButtonVariant; size?: ButtonSize; icon?: LucideIcon; iconPosition?: 'left' | 'right'; loading?: boolean; fullWidth?: boolean; children?: React.ReactNode; } const variantStyles: Record = { primary: 'bg-accent-indigo text-white hover:opacity-90 active:opacity-80', secondary: 'bg-bg-elevated text-text-secondary hover:bg-opacity-80', danger: 'bg-accent-coral text-white hover:opacity-90 active:opacity-80', success: 'bg-accent-green text-white hover:opacity-90 active:opacity-80', ghost: 'bg-transparent text-text-secondary hover:bg-bg-elevated', }; const sizeStyles: Record = { sm: 'px-3 py-1.5 text-small', md: 'px-4 py-2.5 text-body', lg: 'px-6 py-3 text-section-title', }; const iconSizes: Record = { sm: 14, md: 16, lg: 20, }; export const Button: React.FC = ({ variant = 'primary', size = 'md', icon: Icon, iconPosition = 'left', loading = false, fullWidth = false, children, className = '', disabled, ...props }) => { const isDisabled = disabled || loading; const iconSize = iconSizes[size]; return ( ); }; export default Button;