Files
route-commerce/src/components/shared/EmptyState.tsx
T

27 lines
1.2 KiB
TypeScript

"use client";
type EmptyStateProps = {
title: string;
description?: string;
icon?: string;
action?: React.ReactNode;
className?: string;
};
export default function EmptyState({ title, description, icon, action, className = "" }: EmptyStateProps) {
return (
<div className={`flex flex-col items-center justify-center py-16 px-6 text-center ${className}`}>
{icon && <span className="mb-4 text-4xl">{icon}</span>}
{!icon && (
<div className="mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-slate-100">
<svg className="h-6 w-6 text-slate-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" />
</svg>
</div>
)}
<h3 className="text-base font-semibold text-slate-900">{title}</h3>
{description && <p className="mt-1 text-sm text-slate-500 max-w-sm">{description}</p>}
{action && <div className="mt-4">{action}</div>}
</div>
);
}