feat: not found handle page

This commit is contained in:
Project_IO 2025-03-18 02:32:28 +09:00
parent c32e64aed9
commit c206f03313
3 changed files with 34 additions and 11 deletions

View file

@ -8,6 +8,7 @@ import { BrowserRouter, Route, Routes, useLocation } from "react-router";
import "./App.scss"; import "./App.scss";
import kuma from "./assets/kuma.png"; import kuma from "./assets/kuma.png";
import NotFound from "./components/notfound";
function App() { function App() {
return ( return (
@ -41,17 +42,7 @@ function Dashboard() {
return ( return (
<main className="container-md ka-view"> <main className="container-md ka-view">
<Header /> <Header />
{typeof path.data !== "undefined" ? path.data.is_dir ? <Directory /> : <FileView /> : ( {typeof path.data !== "undefined" ? path.data.is_dir ? <Directory /> : <FileView /> : <NotFound />}
<>
<h1>404 Not Found</h1>
<button className="primary" onClick={ev => {
ev.preventDefault();
document.location.href = "/";
}}>Back to home</button>
</>
)}
<Footer /> <Footer />
</main> </main>
); );

View file

@ -0,0 +1,18 @@
import { DynamicIcon } from "lucide-react/dynamic";
import "./notfound.scss";
function NotFound() {
return (
<div className="not-found">
<DynamicIcon className="icon" name="file-question" size={120} />
<h1>404 Not Found</h1>
<button className="primary" onClick={ev => {
ev.preventDefault();
document.location.href = "/";
}}>Back to home</button>
</div>
);
}
export default NotFound;

View file

@ -0,0 +1,14 @@
.not-found {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
.icon {
margin: 3rem 0;
}
.primary {
margin: 0.5rem 0;
}
}