Skip to content

Commit

Permalink
Merge pull request #228 from chingu-x/fix/add-404-back-btn
Browse files Browse the repository at this point in the history
Fix/Add 404 page + update error component styles
  • Loading branch information
Dan-Y-Ko authored Sep 2, 2024
2 parents 56ad08e + ae5dd34 commit 3c12077
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
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

0 comments on commit 3c12077

Please sign in to comment.