error-banner.tsx 695 B

12345678910111213141516171819202122232425262728293031
  1. import type { ReactNode } from "react";
  2. import { cn } from "@/lib/utils";
  3. /**
  4. * Inline error for forms and cards — plain language, not a stack trace.
  5. */
  6. export function ErrorBanner({
  7. children,
  8. className,
  9. title = "Something went wrong",
  10. }: {
  11. children: ReactNode;
  12. className?: string;
  13. title?: string;
  14. }) {
  15. return (
  16. <div
  17. className={cn(
  18. "rounded-lg border border-pending/40 bg-pending-muted px-3 py-3 text-left sm:px-4",
  19. className,
  20. )}
  21. role="alert"
  22. >
  23. <p className="text-sm font-medium text-pending">{title}</p>
  24. <div className="mt-1 text-sm leading-relaxed text-foreground/90">
  25. {children}
  26. </div>
  27. </div>
  28. );
  29. }