Skip to content

Commit 4376a9d

Browse files
feat:added a 404 page
1 parent fa75cba commit 4376a9d

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

src/Pages/404/NoFound.jsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Libraries Imports
2+
import { useNavigate } from "react-router-dom";
3+
import { Typography, Card } from "@material-tailwind/react";
4+
import { FaRegHandBackFist } from "react-icons/fa6";
5+
// Local Imports
6+
import ButtonComp from "../../Components/Button/Button";
7+
8+
const NotFoundPage = () => {
9+
const navigate = useNavigate();
10+
11+
const handleGoHome = () => {
12+
navigate("/");
13+
};
14+
15+
return (
16+
<div className="flex items-center justify-center min-h-screen bg-gray-100 ml-10 mr-10">
17+
<div className="min-w-20 p-8">
18+
<Card className="p-4" shadow={false}>
19+
<div className="mb-4 flex justify-center items-center">
20+
<Typography className="font-bold text-5xl text-black">
21+
404
22+
</Typography>
23+
</div>
24+
<Typography className="mt-2 text-2xl text-black font-medium text-center">
25+
Oops! The page you are looking for does not exist.
26+
</Typography>
27+
<div className="mt-8 text-center">
28+
<ButtonComp
29+
btnClick={handleGoHome}
30+
title="Go back to Home"
31+
btnType="button"
32+
btnIcon={<FaRegHandBackFist size={20} />}
33+
>
34+
Go Back to Home
35+
</ButtonComp>
36+
</div>
37+
</Card>
38+
</div>
39+
</div>
40+
);
41+
};
42+
43+
export default NotFoundPage;

src/Routes/Router.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { Navigate, Route, Routes } from "react-router-dom";
44
// Local Imports
55
import { onAuthStateChanged, auth } from "../Config/firebase.config";
66
import LoaderComp from "../Components/Loader/Loader";
7+
import NotFoundPage from "../Pages/404/NoFound";
78
const SignupLoginPage = lazy(() => import("../Pages/SignupLogin/SignupLogin"));
89
const ChatPage = lazy(() => import("../Pages/Chat/Chat"));
910

1011
function RouterComp() {
1112
const [isUser, setIsUser] = useState(false);
1213
const [loading, setLoading] = useState(true);
13-
console.log("Hello...");
1414

1515
useEffect(() => {
1616
const unsubscribe = onAuthStateChanged(auth, (user) => {
@@ -49,7 +49,7 @@ function RouterComp() {
4949
path="/chat"
5050
element={isUser ? <ChatPage /> : <Navigate to="/" />}
5151
/>
52-
<Route path="*" element={<Navigate to="/" />} />
52+
<Route path="*" element={<NotFoundPage />} />
5353
</Routes>
5454
</Suspense>
5555
);

0 commit comments

Comments
 (0)