-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create reusable NotFound component and add global 404 page; (#139)
* feat: create reusable NotFound component and add global 404 page * fix: remove button from products not found page * chore: remove Prisma and clean up unused files
- Loading branch information
Showing
5 changed files
with
93 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import NotFound from "@/components/shared/not-found"; | ||
|
||
const GlobalNotFound = () => { | ||
return ( | ||
<NotFound | ||
title="Page Not Found" | ||
description="The page you are looking for doesn’t exist or has been moved." | ||
/> | ||
); | ||
}; | ||
|
||
export default GlobalNotFound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
"use client"; | ||
|
||
import { PackageX } from "lucide-react"; | ||
import Link from "next/link"; | ||
|
||
import { Button } from "@/components/ui/button"; | ||
import { useTranslations } from "@/hooks/useTranslations"; | ||
import NotFound from "../shared/not-found"; | ||
|
||
const NotFound = () => { | ||
const { t } = useTranslations(); | ||
const ProductNotFound = () => { | ||
const { t } = useTranslations(); | ||
|
||
return ( | ||
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-150px)] px-4"> | ||
<PackageX className="h-24 w-24 text-muted-foreground mb-8" /> | ||
<h1 className="text-4xl font-bold mb-4">{t("common.notFound.title")}</h1> | ||
<p className="text-lg text-muted-foreground mb-8 text-center"> | ||
{t("common.notFound.description")} | ||
</p> | ||
<div className="flex gap-4"> | ||
<Button asChild> | ||
<Link href="/marketplace"> | ||
{t("common.notFound.browseMarketplace")} | ||
</Link> | ||
</Button> | ||
<Button variant="outline" asChild> | ||
<Link href="/">{t("common.notFound.goHome")}</Link> | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
return ( | ||
<> | ||
<NotFound | ||
icon={PackageX} | ||
title={t("common.notFound.title")} | ||
description={t("common.notFound.description")} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default NotFound; | ||
export default ProductNotFound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"use client"; | ||
|
||
import { AlertCircle } from "lucide-react"; | ||
import Link from "next/link"; | ||
import { Button } from "../ui/button"; | ||
|
||
type NotFoundProps = { | ||
icon?: React.ElementType; | ||
title: string; | ||
description: string; | ||
}; | ||
|
||
const NotFound = ({ | ||
icon: Icon = AlertCircle, | ||
title, | ||
description, | ||
}: NotFoundProps) => { | ||
return ( | ||
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-150px)] px-4"> | ||
<Icon className="h-24 w-24 text-muted-foreground mb-8" /> | ||
<h1 className="text-4xl font-bold mb-4">{title}</h1> | ||
<p className="text-lg text-muted-foreground mb-8 text-center"> | ||
{description} | ||
</p> | ||
<div className="flex gap-4"> | ||
<Button asChild> | ||
<Link href="/marketplace">Browse Marketplace</Link> | ||
</Button> | ||
<Button variant="outline" asChild> | ||
<Link href="/">Go Home</Link> | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotFound; |