From f8d8ff781dc78a09c0f455313bf1782eb4fba962 Mon Sep 17 00:00:00 2001 From: realtradam Date: Thu, 27 Jun 2024 17:03:05 -0400 Subject: add react router --- react-frontend/src/App.tsx | 37 +++----------------------------- react-frontend/src/components/Layout.tsx | 11 ++++++++++ react-frontend/src/pages/Home.tsx | 8 +++++++ react-frontend/src/routes/index.tsx | 16 ++++++++++++++ 4 files changed, 38 insertions(+), 34 deletions(-) create mode 100644 react-frontend/src/components/Layout.tsx create mode 100644 react-frontend/src/pages/Home.tsx create mode 100644 react-frontend/src/routes/index.tsx (limited to 'react-frontend/src') diff --git a/react-frontend/src/App.tsx b/react-frontend/src/App.tsx index b2ba1e4..92de410 100644 --- a/react-frontend/src/App.tsx +++ b/react-frontend/src/App.tsx @@ -1,36 +1,5 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' -import './App.css' +import Routes from "./routes" -function App() { - const [count, setCount] = useState(0) - - return ( - <> -
- - Vite logo - - - React logo - -
-

Game Holster

-

Temp Page

-
- -

- Edit src/App.tsx and save to test HMR -

-
-

- Click on the Vite and React logos to learn more -

- - ) +export default function App() { + return (); } - -export default App diff --git a/react-frontend/src/components/Layout.tsx b/react-frontend/src/components/Layout.tsx new file mode 100644 index 0000000..9221687 --- /dev/null +++ b/react-frontend/src/components/Layout.tsx @@ -0,0 +1,11 @@ +import { Outlet } from "react-router-dom"; + +export default function Layout() +{ + return( + <> +
sidebar
+ + + ); +} diff --git a/react-frontend/src/pages/Home.tsx b/react-frontend/src/pages/Home.tsx new file mode 100644 index 0000000..631adda --- /dev/null +++ b/react-frontend/src/pages/Home.tsx @@ -0,0 +1,8 @@ + +export default function Home() { + return( + <> +

Welcome to Game Holster

+ + ); +} diff --git a/react-frontend/src/routes/index.tsx b/react-frontend/src/routes/index.tsx new file mode 100644 index 0000000..5fcae2b --- /dev/null +++ b/react-frontend/src/routes/index.tsx @@ -0,0 +1,16 @@ +import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; +import Home from "../pages/Home"; +import Layout from "../components/Layout"; + +export default function Index() +{ + return (<> + + + }> + } /> + + + + ); +} -- cgit v1.2.3