Skip to content

Commit

Permalink
Merge pull request #5 from PaulKreft/reactRouter
Browse files Browse the repository at this point in the history
reactRouter
  • Loading branch information
PaulKreft authored Feb 1, 2024
2 parents fbc7d4d + 885f896 commit a5c1d76
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 2 deletions.
39 changes: 39 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.3",
"clsx": "^2.1.0",
"tailwind-merge": "^2.2.0"
},
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
import "./App.css";
import { Route, Routes } from "react-router-dom";
import Home from "./components/home.tsx";
import NotFound from "./components/not-found.tsx";

function App() {
return <>Welcome</>;
return (
<>
<div className="flex min-h-screen flex-col">
<Routes>
<Route path="/" element={<Home />} />
<Route path={"/*"} element={<NotFound />} />
</Routes>
</div>
</>
);
}

export default App;
15 changes: 15 additions & 0 deletions frontend/src/components/home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export default function Home() {
return (
<div className="flex flex-1 flex-col items-center justify-center pb-52">
<h1 className="text-center text-8xl font-extrabold leading-snug">
Welcome to <span className="text-[#3A0842]">H</span>
<span className="text-[#9AB87A]">e</span>
<span className="text-[#444B6E]">x</span>
<span className="text-[#247BA0]">H</span>
<span className="text-[#DC851F]">e</span>
<span className="text-[#F8F991]">x</span>
<span className="text-[#720026]">!</span>
</h1>
</div>
);
}
3 changes: 3 additions & 0 deletions frontend/src/components/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function NotFound() {
return <div>Not Found</div>;
}
5 changes: 4 additions & 1 deletion frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
import { BrowserRouter } from "react-router-dom";

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>,
);

0 comments on commit a5c1d76

Please sign in to comment.