feat: not found handle page
This commit is contained in:
parent
c32e64aed9
commit
c206f03313
3 changed files with 34 additions and 11 deletions
13
src/App.tsx
13
src/App.tsx
|
@ -8,6 +8,7 @@ import { BrowserRouter, Route, Routes, useLocation } from "react-router";
|
|||
|
||||
import "./App.scss";
|
||||
import kuma from "./assets/kuma.png";
|
||||
import NotFound from "./components/notfound";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
|
@ -41,17 +42,7 @@ function Dashboard() {
|
|||
return (
|
||||
<main className="container-md ka-view">
|
||||
<Header />
|
||||
{typeof path.data !== "undefined" ? path.data.is_dir ? <Directory /> : <FileView /> : (
|
||||
<>
|
||||
<h1>404 Not Found</h1>
|
||||
|
||||
<button className="primary" onClick={ev => {
|
||||
ev.preventDefault();
|
||||
document.location.href = "/";
|
||||
}}>Back to home</button>
|
||||
</>
|
||||
)}
|
||||
|
||||
{typeof path.data !== "undefined" ? path.data.is_dir ? <Directory /> : <FileView /> : <NotFound />}
|
||||
<Footer />
|
||||
</main>
|
||||
);
|
||||
|
|
18
src/components/notfound/index.tsx
Normal file
18
src/components/notfound/index.tsx
Normal 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;
|
14
src/components/notfound/notfound.scss
Normal file
14
src/components/notfound/notfound.scss
Normal 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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue