Skip to content

Commit 10df152

Browse files
committed
fix: 404 state
1 parent 10473b7 commit 10df152

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

src/app/(checkout)/not-found.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Metadata } from "next"
2+
import Link from "next/link"
3+
4+
export const metadata: Metadata = {
5+
title: "404",
6+
description: "Something went wrong",
7+
}
8+
9+
export default function NotFound() {
10+
return (
11+
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)]">
12+
<h1 className="text-2xl-semi text-gry-900">Page not found</h1>
13+
<p className="text-small-regular text-gray-700">
14+
The page you tried to access does not exist.
15+
</p>
16+
<Link href="/" className="mt-4 underline text-base-regular text-gray-900">
17+
Go to frontpage
18+
</Link>
19+
</div>
20+
)
21+
}

src/app/(main)/not-found.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Metadata } from "next"
2+
import Link from "next/link"
3+
4+
export const metadata: Metadata = {
5+
title: "404",
6+
description: "Something went wrong",
7+
}
8+
9+
export default function NotFound() {
10+
return (
11+
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)]">
12+
<h1 className="text-2xl-semi text-gry-900">Page not found</h1>
13+
<p className="text-small-regular text-gray-700">
14+
The page you tried to access does not exist.
15+
</p>
16+
<Link href="/" className="mt-4 underline text-base-regular text-gray-900">
17+
Go to frontpage
18+
</Link>
19+
</div>
20+
)
21+
}

src/modules/categories/templates/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import React, { useEffect } from "react"
1515
import { useInView } from "react-intersection-observer"
1616
import Link from "next/link"
1717
import UnderlineLink from "@modules/common/components/underline-link"
18+
import { notFound } from "next/navigation"
1819

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

31+
if (!category) notFound()
32+
3033
const {
3134
data: infiniteData,
3235
hasNextPage,

0 commit comments

Comments
 (0)