import type { ReactNode } from 'react';

type Props = {
    title: string;
    description?: ReactNode;
    /** A button or link that resolves the emptiness. */
    action?: ReactNode;
};

/** What a list shows instead of rows when there is nothing to list. */
export function EmptyState({ title, description, action }: Props) {
    return (
        <div className="flex flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-12 text-center">
            <p className="font-medium">{title}</p>
            {description && (
                <p className="max-w-md text-sm text-muted-foreground">
                    {description}
                </p>
            )}
            {action && <div className="mt-2">{action}</div>}
        </div>
    );
}
