import { forwardRef } from 'react' import type { ButtonHTMLAttributes, ReactNode } from 'react' import { motion } from 'framer-motion' import { Sparkles, Loader2 } from 'lucide-react' import { cn } from '@/lib/utils' interface AiButtonProps extends ButtonHTMLAttributes { children: ReactNode loading?: boolean /** 隐藏左侧 sparkle 图标 */ noIcon?: boolean } /** 渐变 AI 按钮:白底 + 渐变描边 + 渐变文字,全站 AI 能力入口统一视觉 */ const AiButton = forwardRef( ({ children, loading, noIcon, className, ...props }, ref) => { return ( {loading ? ( ) : ( !noIcon && )} {children} ) }, ) AiButton.displayName = 'AiButton' export default AiButton /** 主按钮:蓝底白字,hover 微放大,带 Loading 态 */ export function PrimaryButton({ children, loading, className, ...props }: ButtonHTMLAttributes & { loading?: boolean }) { return ( {loading && } {children} ) } /** 幽灵按钮:白底 1px 灰边;默认普通按钮,避免弹窗“取消”触发表单提交。 */ export function GhostButton({ children, className, ...props }: ButtonHTMLAttributes) { return ( {children} ) }