pollo/app/components/FourOhFour.tsx

83 lines
2.4 KiB
TypeScript
Raw Normal View History

2023-11-27 11:49:46 -07:00
import { Link, isRouteErrorResponse, useRouteError } from "@remix-run/react";
export default function FourOhFour() {
2023-11-27 11:49:46 -07:00
const error = useRouteError();
2023-11-27 15:17:27 -07:00
// If error response is sent, use correct errors
2023-11-27 11:49:46 -07:00
if (isRouteErrorResponse(error)) {
2023-11-27 16:36:53 -07:00
return (
<span className="text-center">
2023-11-27 20:22:36 -07:00
<h1 className="text-5xl text-error font-bold m-2">
Error {error.status}
</h1>
<h1 className="text-3xl font-bold m-2">{error.data}</h1>
2023-11-27 18:32:31 -07:00
<h2 className="text-2xl font-bold m-2">
If you believe you reached this page in error, please file an issue{" "}
<a
href="https://github.com/atridadl/sprintpadawan/issues/new"
className="link link-secondary"
>
here
</a>
</h2>
<Link
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
2023-11-27 16:36:53 -07:00
>
2023-11-27 18:32:31 -07:00
Back to Home
</Link>
</span>
2023-11-27 16:36:53 -07:00
);
} else if (error instanceof Error) {
return (
2023-11-27 18:32:31 -07:00
<span className="text-center">
2023-11-27 20:22:36 -07:00
<h1 className="text-5xl text-error font-bold m-2">
Error {error.name}
</h1>
2023-11-27 18:32:31 -07:00
<h1 className="text-3xl font-bold m-2">Error {error.message}</h1>
<h2 className="text-2xl font-bold m-2">
If you believe you reached this page in error, please file an issue{" "}
<a
href="https://github.com/atridadl/sprintpadawan/issues/new"
className="link link-secondary"
>
here
</a>
</h2>
<Link
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
>
2023-11-27 18:32:31 -07:00
Back to Home
</Link>
</span>
2023-11-27 16:36:53 -07:00
);
} else {
2023-11-27 18:32:31 -07:00
return (
<span className="text-center">
2023-11-27 20:22:36 -07:00
<h1 className="text-5xl text-error font-bold m-2">Error 500</h1>
2023-11-27 18:32:31 -07:00
<h2 className="text-2xl font-bold m-2">
If you believe you reached this page in error, please file an issue{" "}
<a
href="https://github.com/atridadl/sprintpadawan/issues/new"
className="link link-secondary"
>
here
</a>
</h2>
<Link
about="Back to home."
to="/"
className="btn btn-secondary normal-case text-xl m-2"
2023-11-27 16:36:53 -07:00
>
2023-11-27 18:32:31 -07:00
Back to Home
</Link>
</span>
);
2023-11-27 16:36:53 -07:00
}
}