File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed
Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import Question_Type from "./pages/Question_Type";
55import Text_Input from "./pages/Text_Input" ;
66import Output from "./pages/Output" ;
77import Previous from "./pages/Previous" ;
8+ import NotFound from "./pages/PageNotFound" ;
89
910function App ( ) {
1011 return (
@@ -15,6 +16,7 @@ function App() {
1516 < Route path = "/input" element = { < Text_Input /> } />
1617 < Route path = "/output" element = { < Output /> } />
1718 < Route path = "/history" element = { < Previous /> } />
19+ < Route path = "*" element = { < NotFound /> } />
1820 </ Routes >
1921 </ BrowserRouter >
2022 ) ;
Original file line number Diff line number Diff line change 1+ import React , { useEffect , useState } from 'react' ;
2+ import { useNavigate } from 'react-router-dom' ;
3+ import "../index.css" ;
4+ const NotFound = ( ) => {
5+ const router = useNavigate ( )
6+ const [ countdown , setCountdown ] = useState ( 5 ) ;
7+
8+ useEffect ( ( ) => {
9+ const timer = setInterval ( ( ) => {
10+ setCountdown ( ( prev ) => prev - 1 ) ;
11+ } , 1000 ) ;
12+
13+ const redirect = setTimeout ( ( ) => {
14+ router ( '/' )
15+ } , 5000 ) ;
16+
17+ return ( ) => {
18+ clearInterval ( timer ) ;
19+ clearTimeout ( redirect ) ;
20+ } ;
21+ } , [ ] ) ;
22+
23+ return (
24+ < div className = "min-h-screen flex items-center justify-center popup bg-[#02000F] bg-custom-gradient" >
25+ < div className = "text-center p-8 bg-gray-800 rounded-lg shadow-xl max-w-md border border-gray-700" >
26+ < h1 className = "text-6xl font-bold text-blue-400 mb-4" > 404</ h1 >
27+ < h2 className = "text-2xl font-semibold text-gray-200 mb-4" > Page Not Found</ h2 >
28+ < p className = "text-gray-300 mb-6" >
29+ Oops! The page you're looking for doesn't exist.
30+ </ p >
31+ < p className = "text-gray-400" >
32+ Redirecting to home page in < span className = "text-blue-400" > { countdown } </ span > seconds...
33+ </ p >
34+ </ div >
35+ </ div >
36+ ) ;
37+ } ;
38+
39+ export default NotFound ;
You can’t perform that action at this time.
0 commit comments