Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Add 404 page + update error component styles #228

Merged
merged 5 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/img/error_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/img/error_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import ErrorComponent from "@/components/Error";

function NotFoundPage() {
return (
<div className="flex h-screen flex-col items-start justify-center">
<ErrorComponent message="This page could not be found" />
</div>
);
}

export default NotFoundPage;
27 changes: 21 additions & 6 deletions src/components/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Button from "./Button";

import routePaths from "@/utils/routePaths";
import { type ErrorType } from "@/utils/error";
import Banner from "@/components/banner/Banner";

interface ErrorProps {
message: string;
Expand All @@ -30,18 +31,30 @@ export default function ErrorComponent({
}

return (
<div className="mx-auto mt-2 flex w-full max-w-[600px] flex-col items-center justify-center gap-y-5">
<h1 className="text-xl font-semibold capitalize">Error</h1>
<p className="font-medium">The following error occured:</p>
<div className="flex w-full flex-col gap-y-2 rounded-lg bg-error-content/50 px-6 py-4 text-center font-semibold uppercase">
<p>{errorType ? errorType : ""}</p>
<p>{message}.</p>
<div className="mx-auto flex h-[calc(100vh-155px)] w-full max-w-[628px] flex-col items-center justify-center gap-y-6">
<Banner
imageLight="/img/error_light.png"
imageDark="/img/error_dark.png"
alt="error_banner"
height="h-[315px]"
width="w-[484px]"
/>
<div className="flex flex-col items-center gap-y-8">
<h1 className="text-3xl font-semibold uppercase text-primary">Error</h1>
<span className="text-lg font-medium text-base-300">
The following error occurred:
</span>
<div className="flex flex-col items-center gap-y-2 text-lg font-medium uppercase text-base-300">
<h2>{errorType ? errorType : ""}</h2>
<span>{message}.</span>
</div>
</div>
<div className="flex w-full gap-x-10">
<Button
className="w-full"
variant="neutral"
type="button"
size="lg"
onClick={handleResetAndRefresh}
>
Try again
Expand All @@ -50,6 +63,7 @@ export default function ErrorComponent({
<Button
className="w-full"
type="button"
size="lg"
onClick={() => router.push(routePaths.signIn())}
>
Log in
Expand All @@ -58,6 +72,7 @@ export default function ErrorComponent({
<Button
className="w-full"
type="button"
size="lg"
onClick={() => router.push(routePaths.dashboardPage())}
>
Return to dashboard
Expand Down
Loading