-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19f9c34
commit aafe611
Showing
4 changed files
with
68 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from "react"; | ||
import { Metadata } from "next"; | ||
import Link from "next/link"; | ||
|
||
export const metadata: Metadata = { | ||
title: "❓Image Not Found", | ||
description: "Sorry, this image cannot be found.", | ||
}; | ||
|
||
const NotFoundPage = () => { | ||
return ( | ||
<div className="min-h-screen flex flex-col justify-center items-center"> | ||
<h1 className="text-6xl font-bold text-gray-900 mb-4">404</h1> | ||
<p className="text-xl text-gray-600 mb-8"> | ||
Sorry, this image cannot be found. | ||
</p> | ||
<Link | ||
href="/" | ||
className="px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition" | ||
> | ||
Go back home | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotFoundPage; |
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,27 @@ | ||
import React from "react"; | ||
import { Metadata } from "next"; | ||
import Link from "next/link"; | ||
|
||
export const metadata: Metadata = { | ||
title: "Page Not Found", | ||
description: "Sorry, this page cannot be found.", | ||
}; | ||
|
||
const NotFoundPage = () => { | ||
return ( | ||
<div className="min-h-screen flex flex-col justify-center items-center"> | ||
<h1 className="text-6xl font-bold text-gray-900 mb-4">404</h1> | ||
<p className="text-xl text-gray-600 mb-8"> | ||
Sorry, this page cannot be found. | ||
</p> | ||
<Link | ||
href="/" | ||
className="px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700 transition" | ||
> | ||
Go back home | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
|
||
export default NotFoundPage; |
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,11 +1,13 @@ | ||
import sampleImages from "@/constants/sampleImages"; | ||
import sampleImages, { SampleImage } from "@/constants/sampleImages"; | ||
|
||
export default async function getImage(id: string) { | ||
export default async function getImage( | ||
id: string | ||
): Promise<SampleImage | undefined> { | ||
const numericId = Number(id) - 1; | ||
|
||
if (isNaN(numericId) || numericId < 0) { | ||
return sampleImages[0]; // fallback | ||
if (isNaN(numericId) || numericId < 0 || numericId >= sampleImages.length) { | ||
return undefined; | ||
} | ||
|
||
return sampleImages[numericId % sampleImages.length]; | ||
return sampleImages[numericId]; | ||
} |