| import { ReactNode } from 'react'; | |
| import { cn } from '@/lib/utils'; | |
| interface EmptyStateProps { | |
| icon: ReactNode; | |
| title: string; | |
| description?: string; | |
| action?: ReactNode; | |
| className?: string; | |
| } | |
| export function EmptyState({ | |
| icon, | |
| title, | |
| description, | |
| action, | |
| className, | |
| }: EmptyStateProps) { | |
| return ( | |
| <div | |
| className={cn( | |
| 'flex flex-col items-center justify-center py-12 px-4', | |
| className | |
| )} | |
| > | |
| {/* 图标容器 */} | |
| <div | |
| className={cn( | |
| 'h-16 w-16 rounded-xl flex items-center justify-center mb-4', | |
| 'bg-gradient-to-br from-teal-100/80 to-cyan-100/50', | |
| 'text-teal-600' | |
| )} | |
| > | |
| {icon} | |
| </div> | |
| {/* 标题 */} | |
| <h3 className="text-base font-semibold text-gray-800 mb-1">{title}</h3> | |
| {/* 描述 */} | |
| {description && ( | |
| <p className="text-sm text-teal-600/60 text-center max-w-xs mb-4"> | |
| {description} | |
| </p> | |
| )} | |
| {/* 操作按钮区域 */} | |
| {action && <div className="mt-2">{action}</div>} | |
| </div> | |
| ); | |
| } |