import { isRouteErrorResponse, useRouteError } from "@remix-run/react"; import { friendlyErrorDisplay } from "~/utils/httpErrors"; import { type ReactNode } from "react"; import { Button } from "./ui"; import { Header1 } from "./ui/Headers"; import { Paragraph } from "./ui/Paragraph"; type ErrorDisplayOptions = { button?: { title: string; to: string; }; }; export function RouteErrorDisplay(options?: ErrorDisplayOptions) { const error = useRouteError(); return ( <> {isRouteErrorResponse(error) ? ( ) : error instanceof Error ? ( ) : ( )} ); } type DisplayOptionsProps = { title: string; message?: ReactNode; } & ErrorDisplayOptions; export function ErrorDisplay({ title, message, button }: DisplayOptionsProps) { return (
{title} {message && {message}}
); }