File size: 1,091 Bytes
d0c18f0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 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>
);
} |