empty-state.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import type { ReactNode } from "react";
  2. import { cn } from "@/lib/utils";
  3. /**
  4. * Calm empty / blocked / offline message for portal pages.
  5. */
  6. export function EmptyState({
  7. title,
  8. description,
  9. action,
  10. className,
  11. tone = "default",
  12. }: {
  13. title: string;
  14. description: string;
  15. action?: ReactNode;
  16. className?: string;
  17. tone?: "default" | "warning" | "ok";
  18. }) {
  19. return (
  20. <div
  21. className={cn(
  22. "flex flex-col items-center justify-center rounded-xl border border-border bg-card/40 px-5 py-10 text-center sm:px-8",
  23. className,
  24. )}
  25. role="status"
  26. >
  27. <p
  28. className={cn(
  29. "text-sm font-medium",
  30. tone === "warning" && "text-pending",
  31. tone === "ok" && "text-proof",
  32. tone === "default" && "text-muted-foreground",
  33. )}
  34. >
  35. {title}
  36. </p>
  37. <p className="mt-2 max-w-md text-sm leading-relaxed text-muted-foreground">
  38. {description}
  39. </p>
  40. {action ? <div className="mt-5 flex flex-wrap justify-center gap-2">{action}</div> : null}
  41. </div>
  42. );
  43. }