Skip to content

Commit

Permalink
feat: add basic file structure and routing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tedzury committed Dec 10, 2023
1 parent 524b1cf commit b79bdc0
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 6 deletions.
35 changes: 29 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@
import { createHashRouter, RouterProvider } from 'react-router-dom';

import MainLayout from '@/layouts/MainLayout';
import LoginPage from '@pages/LoginPage';
import MainPage from '@pages/MainPage';
import WelcomePage from '@pages/WelcomePage';

const router = createHashRouter([
{
path: '/',
element: <MainLayout />,
children: [
{
path: '/',
element: <WelcomePage />,
},
{
path: 'login',
element: <LoginPage />,
},
{
path: 'mainpage',
element: <MainPage />,
},
],
},
]);

function App() {
return (
<div className="h-[100dvh] bg-[green] text-3xl">
<div>Hello, I&apos;m the future graphiql app!</div>
<div>Trulala</div>
</div>
);
return <RouterProvider router={router} />;
}

export default App;
13 changes: 13 additions & 0 deletions src/layouts/MainLayout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Outlet } from 'react-router-dom';

export default function MainLayout() {
return (
<main>
<header>Here will be header</header>
<section>
<Outlet />
</section>
<footer>Here will be footer</footer>
</main>
);
}
Empty file removed src/pages/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions src/pages/LoginPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function LoginPage() {
return <section>Here is my fancy login page!</section>;
}
3 changes: 3 additions & 0 deletions src/pages/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function LoginPage() {
return <section>Here is my fancy main page!</section>;
}
13 changes: 13 additions & 0 deletions src/pages/WelcomePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Link } from 'react-router-dom';

export default function LoginPage() {
return (
<section>
Here is my fancy welcome page!
<div className="flex flex-col">
<Link to="../login">login</Link>
<Link to="../mainpage">main page</Link>
</div>
</section>
);
}

0 comments on commit b79bdc0

Please sign in to comment.