59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import React from 'react'
|
|
import clsx from 'clsx'
|
|
import { Button } from '../ui/Button'
|
|
|
|
export interface EmptyStateProps {
|
|
title: string
|
|
description?: string
|
|
actionLabel?: string
|
|
onAction?: () => void
|
|
icon?: React.ReactNode
|
|
className?: string
|
|
}
|
|
|
|
export const EmptyState: React.FC<EmptyStateProps> = ({
|
|
title,
|
|
description,
|
|
actionLabel,
|
|
onAction,
|
|
icon,
|
|
className,
|
|
}) => {
|
|
return (
|
|
<div
|
|
className={clsx(
|
|
'flex flex-col items-center justify-center rounded-2xl border border-dashed border-slate-200 bg-slate-50/40 px-6 py-12 text-center',
|
|
className
|
|
)}
|
|
>
|
|
<div className="mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-orange-50 text-[#C95C3C]">
|
|
{icon || (
|
|
<svg
|
|
className="h-6 w-6"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
stroke="currentColor"
|
|
strokeWidth={1.8}
|
|
>
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"
|
|
/>
|
|
</svg>
|
|
)}
|
|
</div>
|
|
<h4 className="text-base font-semibold text-slate-900">{title}</h4>
|
|
{description && (
|
|
<p className="mt-1 max-w-sm text-sm text-slate-500">{description}</p>
|
|
)}
|
|
{actionLabel && onAction && (
|
|
<div className="mt-4">
|
|
<Button variant="primary" size="sm" onClick={onAction}>
|
|
{actionLabel}
|
|
</Button>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|