Skip to content

Commit

Permalink
fix: 404 state
Browse files Browse the repository at this point in the history
  • Loading branch information
VariableVic committed Sep 19, 2023
1 parent 10473b7 commit 10df152
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/app/(checkout)/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Metadata } from "next"
import Link from "next/link"

export const metadata: Metadata = {
title: "404",
description: "Something went wrong",
}

export default function NotFound() {
return (
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)]">
<h1 className="text-2xl-semi text-gry-900">Page not found</h1>
<p className="text-small-regular text-gray-700">
The page you tried to access does not exist.
</p>
<Link href="/" className="mt-4 underline text-base-regular text-gray-900">
Go to frontpage
</Link>
</div>
)
}
21 changes: 21 additions & 0 deletions src/app/(main)/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Metadata } from "next"
import Link from "next/link"

export const metadata: Metadata = {
title: "404",
description: "Something went wrong",
}

export default function NotFound() {
return (
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)]">
<h1 className="text-2xl-semi text-gry-900">Page not found</h1>
<p className="text-small-regular text-gray-700">
The page you tried to access does not exist.
</p>
<Link href="/" className="mt-4 underline text-base-regular text-gray-900">
Go to frontpage
</Link>
</div>
)
}
3 changes: 3 additions & 0 deletions src/modules/categories/templates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import React, { useEffect } from "react"
import { useInView } from "react-intersection-observer"
import Link from "next/link"
import UnderlineLink from "@modules/common/components/underline-link"
import { notFound } from "next/navigation"

type CategoryTemplateProps = {
categories: ProductCategoryWithChildren[]
Expand All @@ -27,6 +28,8 @@ const CategoryTemplate: React.FC<CategoryTemplateProps> = ({ categories }) => {
const category = categories[categories.length - 1]
const parents = categories.slice(0, categories.length - 1)

if (!category) notFound()

const {
data: infiniteData,
hasNextPage,
Expand Down

0 comments on commit 10df152

Please sign in to comment.