Skip to content

Commit e3cdae8

Browse files
authored
Merge pull request #157 from SouravKumarBarman/feature/404
404 page
2 parents e122fd6 + 1614653 commit e3cdae8

4 files changed

Lines changed: 73 additions & 0 deletions

File tree

4.04 MB
Loading

public/images/pnf-mob.png

3.06 MB
Loading
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import { Link } from "react-router-dom";
2+
import { useEffect } from "react";
3+
4+
export default function NotFound() {
5+
useEffect(() => {
6+
// Dynamically add Google Font
7+
const link = document.createElement("link");
8+
link.href = "https://fonts.googleapis.com/css2?family=Rubik+Dirt&display=swap";
9+
link.rel = "stylesheet";
10+
document.head.appendChild(link);
11+
}, []);
12+
const isMobile = window.innerWidth < 768;
13+
14+
return (
15+
<div
16+
className="relative min-h-screen bg-cover bg-center md:flex justify-center items-center text-white text-center px-4"
17+
style={{
18+
backgroundImage: isMobile
19+
? "url('/images/pnf-mob.png')" // mobile image
20+
: "url('/images/notFoundLandscape.png')", // desktop image
21+
}}
22+
>
23+
24+
<div className="md:w-1/2 max-w-2xl px-12 pt-30 md:pt-0">
25+
{/* 404 text */}
26+
<h1
27+
className="text-9xl md:text-9xl font-extrabold tracking-widest"
28+
>
29+
404
30+
</h1>
31+
32+
{/* Subtitle */}
33+
<h2
34+
className="text-4xl md:text-7xl mt-4 "
35+
style={{ fontFamily: "'Rubik Dirt', cursive" }}
36+
>
37+
NOT FOUND
38+
</h2>
39+
40+
{/* Description */}
41+
<p className="uppercase mt-6 font-semibold">
42+
Oops! This page wandered off the workout plan.
43+
</p>
44+
45+
<p className="mt-3 text-gray-400 leading-relaxed">
46+
Looks like the page you're looking for doesn't exist. But don't worry —
47+
your fitness journey doesn't stop here. Fuel your goals with CoreX supplements.
48+
</p>
49+
50+
{/* Buttons */}
51+
<div className="mt-8 flex flex-col sm:flex-row gap-4 justify-center">
52+
<Link
53+
to="/"
54+
className="bg-white text-black px-6 py-3 rounded-2xl font-semibold hover:bg-red-600 hover:text-white transition"
55+
>
56+
GO TO HOME PAGE
57+
</Link>
58+
59+
<Link
60+
to="/products"
61+
className="border border-white px-6 py-3 rounded-2xl font-semibold hover:bg-red-600 hover:border-red-600 transition"
62+
>
63+
CONTINUE SHOPPING
64+
</Link>
65+
</div>
66+
</div>
67+
<div class="w-1/2 bg-blue-500"></div>
68+
</div>
69+
);
70+
}

src/routes/RouterConfig.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ const GarageSale = lazy(() => import('../pages/GarageSale/GarageSale'));
2525
const Register = lazy(() => import('../pages/Register'));
2626
const Login = lazy(() => import('../pages/Login'));
2727

28+
const NotFound = lazy(() => import('../pages/PageNotFound/NotFound'));
29+
2830
// Router configuration
2931
export const RouterConfig = () =>
3032
createRoutesFromElements(
@@ -43,6 +45,7 @@ export const RouterConfig = () =>
4345
<Route path="shipping-policy" element={<ShippingPolicy />} />
4446
<Route path="terms-of-service" element={<TermsOfService />} />
4547
<Route path="garage-sale" element={<GarageSale />} />
48+
<Route path="*" element={<NotFound />} />
4649
</Route>
4750
</>
4851
);

0 commit comments

Comments
 (0)