Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ import Error from "./components/Error/Error";
import SearchInput from "./components/Search/SearchInput";
import Layout from "./components/Layout/Layout";
import BGShape from "./components/BGShape";
// import { Route, Routes } from "react-router-dom";
// import NotFound from "./pages/404";


function App() {
const [search, setSearch] = useState('')
const [type, setType] = useState('')
return (

<>
{/* <Routes>
<Route errorElement={<NotFound></NotFound>} path='*'/>
</Routes> */}
<Layout>
<SearchInput
search={search}
setSearch={setSearch}
setType={setType}
/>
<Error
<Error
search={search}
type={type}
/>
Expand Down
6 changes: 5 additions & 1 deletion src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import Doc from "./components/Doc/Doc";
import Contributors from "./components/Contributors/contributors";
import BGShape from "./components/BGShape";
import NotFound from "./pages/404";
/* Creating a router object that is used to render the correct component based on the url. */
const router = createBrowserRouter(
[
Expand All @@ -22,6 +23,9 @@ const router = createBrowserRouter(
{
path: '/Contributors',
element: <Contributors />
},
{path: '*',
element: <NotFound />
}

]
Expand All @@ -32,4 +36,4 @@ ReactDOM.createRoot(document.getElementById("root")).render(
<BGShape />
<RouterProvider router={router} />
</React.StrictMode>
);
);
13 changes: 13 additions & 0 deletions src/pages/404.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Link } from "react-router-dom";

export default function NotFound() {
    return (
        <div class="flex h-screen">
<div class="m-auto">
             <h1 class="mb-5">Not found</h1>

             <Link to='/' class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800">Home</Link>
</div>
</div>
)
}