| 1 | /** |
| 2 | * Empty - 空状态组件 |
| 3 | * 用于显示空数据状态 |
| 4 | */ |
| 5 | |
| 6 | 'use client' |
| 7 | |
| 8 | import { cn } from '@/utils/className' |
| 9 | |
| 10 | interface EmptyProps { |
| 11 | /** 描述文字 */ |
| 12 | description?: React.ReactNode |
| 13 | /** 自定义图标 */ |
| 14 | image?: React.ReactNode |
| 15 | /** 自定义类名 */ |
| 16 | className?: string |
| 17 | } |
| 18 | |
| 19 | export function Empty({ description = '暂无数据', image, className }: EmptyProps) { |
| 20 | return ( |
| 21 | <div className={cn('flex flex-col items-center justify-center py-12 px-4', className)}> |
| 22 | {image || <div className="text-6xl mb-4 opacity-30">📭</div>} |
| 23 | <div className="text-sm text-muted-foreground">{description}</div> |
| 24 | </div> |
| 25 | ) |
| 26 | } |
| 27 |