50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
|
|
import { LucideIcon } from 'lucide-react'
|
||
|
|
import { Button } from '@/components/ui/button'
|
||
|
|
import { cn } from '@/lib/utils'
|
||
|
|
|
||
|
|
interface EmptyStateProps {
|
||
|
|
icon: LucideIcon
|
||
|
|
title: string
|
||
|
|
description?: string
|
||
|
|
action?: {
|
||
|
|
label: string
|
||
|
|
href?: string
|
||
|
|
onClick?: () => void
|
||
|
|
}
|
||
|
|
className?: string
|
||
|
|
}
|
||
|
|
|
||
|
|
export function EmptyState({
|
||
|
|
icon: Icon,
|
||
|
|
title,
|
||
|
|
description,
|
||
|
|
action,
|
||
|
|
className,
|
||
|
|
}: EmptyStateProps) {
|
||
|
|
return (
|
||
|
|
<div
|
||
|
|
className={cn(
|
||
|
|
'flex flex-col items-center justify-center py-12 text-center',
|
||
|
|
className
|
||
|
|
)}
|
||
|
|
>
|
||
|
|
<Icon className="h-12 w-12 text-muted-foreground/50" />
|
||
|
|
<h3 className="mt-4 font-medium">{title}</h3>
|
||
|
|
{description && (
|
||
|
|
<p className="mt-1 max-w-sm text-sm text-muted-foreground">
|
||
|
|
{description}
|
||
|
|
</p>
|
||
|
|
)}
|
||
|
|
{action && (
|
||
|
|
<Button
|
||
|
|
className="mt-4"
|
||
|
|
onClick={action.onClick}
|
||
|
|
asChild={!!action.href}
|
||
|
|
>
|
||
|
|
{action.href ? <a href={action.href}>{action.label}</a> : action.label}
|
||
|
|
</Button>
|
||
|
|
)}
|
||
|
|
</div>
|
||
|
|
)
|
||
|
|
}
|