Function
EmptyState
({
icon: Icon,
title,
description,
action,
className,
}: {
icon: LucideIcon;
title: React.ReactNode;
description?: React.ReactNode;
action?: React.ReactNode;
className?: string;
})
Source from the content-addressed store, hash-verified
| 6 | * 空态四要素:图标 + 主文案 + 副文案 + 可选操作。 |
| 7 | */ |
| 8 | export function EmptyState({ |
| 9 | icon: Icon, |
| 10 | title, |
| 11 | description, |
| 12 | action, |
| 13 | className, |
| 14 | }: { |
| 15 | icon: LucideIcon; |
| 16 | title: React.ReactNode; |
| 17 | description?: React.ReactNode; |
| 18 | action?: React.ReactNode; |
| 19 | className?: string; |
| 20 | }) { |
| 21 | return ( |
| 22 | <div |
| 23 | className={cn( |
| 24 | 'flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed px-6 py-10 text-center', |
| 25 | className, |
| 26 | )} |
| 27 | > |
| 28 | <span className="flex h-11 w-11 items-center justify-center rounded-full bg-muted"> |
| 29 | <Icon className="h-5 w-5 text-muted-foreground" /> |
| 30 | </span> |
| 31 | <p className="text-sm font-medium">{title}</p> |
| 32 | {description ? ( |
| 33 | <p className="max-w-sm text-xs text-muted-foreground">{description}</p> |
| 34 | ) : null} |
| 35 | {action ? <div className="mt-2">{action}</div> : null} |
| 36 | </div> |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | export default EmptyState; |
Callers
nothing calls this directly
Tested by
no test coverage detected