diff --git a/src/App.css b/src/App.css
deleted file mode 100644
index b9d355d..0000000
--- a/src/App.css
+++ /dev/null
@@ -1,42 +0,0 @@
-#root {
- max-width: 1280px;
- margin: 0 auto;
- padding: 2rem;
- text-align: center;
-}
-
-.logo {
- height: 6em;
- padding: 1.5em;
- will-change: filter;
- transition: filter 300ms;
-}
-.logo:hover {
- filter: drop-shadow(0 0 2em #646cffaa);
-}
-.logo.react:hover {
- filter: drop-shadow(0 0 2em #61dafbaa);
-}
-
-@keyframes logo-spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
-}
-
-@media (prefers-reduced-motion: no-preference) {
- a:nth-of-type(2) .logo {
- animation: logo-spin infinite 20s linear;
- }
-}
-
-.card {
- padding: 2em;
-}
-
-.read-the-docs {
- color: #888;
-}
diff --git a/src/App.test.tsx b/src/App.test.tsx
index e7dc3c7..4ca6841 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -1,11 +1,21 @@
-import { describe, it } from "vitest";
-import { render, screen } from '@testing-library/react'
-import App from './App'
+import { describe, it, expect } from "vitest";
+import { render, screen } from "@testing-library/react";
+import { MemoryRouter } from "react-router";
+import App from "./App";
-describe('App', () => {
- it('renders the App component', () => {
- render( )
-
- screen.debug(); // prints out the jsx in the App component unto the command line
- })
-})
\ No newline at end of file
+describe("App", () => {
+ it("renders the App component", () => {
+ // arrange
+ render(
+
+
+
+ );
+
+ // act
+ let text = screen.getByText("⚛️ React Boilerplate");
+
+ // assert
+ expect(text).toBeInTheDocument();
+ });
+});
diff --git a/src/App.tsx b/src/App.tsx
index 88ab6da..7945b6d 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,21 +1,9 @@
-import "./App.css";
-import { motion } from "framer-motion";
+import HomePage from "./pages/Home";
+
function App() {
return (
- <>
-
- ⚛️ React Boilerplate
-
-
- Status: 🟢 In progress.
-
- >
+
);
}
diff --git a/src/index.css b/src/index.css
deleted file mode 100644
index 6119ad9..0000000
--- a/src/index.css
+++ /dev/null
@@ -1,68 +0,0 @@
-:root {
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
- line-height: 1.5;
- font-weight: 400;
-
- color-scheme: light dark;
- color: rgba(255, 255, 255, 0.87);
- background-color: #242424;
-
- font-synthesis: none;
- text-rendering: optimizeLegibility;
- -webkit-font-smoothing: antialiased;
- -moz-osx-font-smoothing: grayscale;
-}
-
-a {
- font-weight: 500;
- color: #646cff;
- text-decoration: inherit;
-}
-a:hover {
- color: #535bf2;
-}
-
-body {
- margin: 0;
- display: flex;
- place-items: center;
- min-width: 320px;
- min-height: 100vh;
-}
-
-h1 {
- font-size: 3.2em;
- line-height: 1.1;
-}
-
-button {
- border-radius: 8px;
- border: 1px solid transparent;
- padding: 0.6em 1.2em;
- font-size: 1em;
- font-weight: 500;
- font-family: inherit;
- background-color: #1a1a1a;
- cursor: pointer;
- transition: border-color 0.25s;
-}
-button:hover {
- border-color: #646cff;
-}
-button:focus,
-button:focus-visible {
- outline: 4px auto -webkit-focus-ring-color;
-}
-
-@media (prefers-color-scheme: light) {
- :root {
- color: #213547;
- background-color: #ffffff;
- }
- a:hover {
- color: #747bff;
- }
- button {
- background-color: #f9f9f9;
- }
-}
diff --git a/src/main.tsx b/src/main.tsx
index bef5202..283f87c 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,10 +1,26 @@
-import { StrictMode } from 'react'
-import { createRoot } from 'react-dom/client'
-import './index.css'
-import App from './App.tsx'
+import { StrictMode } from "react";
+import { createRoot } from "react-dom/client";
+import { createBrowserRouter, RouterProvider } from "react-router";
-createRoot(document.getElementById('root')!).render(
+// page components
+import App from "./App.tsx";
+import AboutPage from "./pages/About/index.tsx";
+import ErrorPage from "./pages/ErrorPage.tsx";
+
+const router = createBrowserRouter([
+ {
+ path: "/",
+ element: ,
+ errorElement: ,
+ },
+ {
+ path: "/about",
+ element: ,
+ },
+]);
+
+createRoot(document.getElementById("root")!).render(
-
- ,
-)
+
+
+);
diff --git a/src/pages/About/About.test.tsx b/src/pages/About/About.test.tsx
new file mode 100644
index 0000000..db8e3a2
--- /dev/null
+++ b/src/pages/About/About.test.tsx
@@ -0,0 +1,21 @@
+import { describe, it, expect } from "vitest";
+import { render, screen } from "@testing-library/react";
+import { MemoryRouter } from "react-router";
+import AboutPage from ".";
+
+describe("About Page", () => {
+ it("should render the about page", () => {
+ // arrange
+ render(
+
+
+
+ );
+
+ // act
+ let heading = screen.getByRole("heading");
+
+ // assert
+ expect(heading).toHaveTextContent(/about this project/i);
+ });
+});
diff --git a/src/pages/About/index.tsx b/src/pages/About/index.tsx
new file mode 100644
index 0000000..9f9215c
--- /dev/null
+++ b/src/pages/About/index.tsx
@@ -0,0 +1,28 @@
+import { Link } from "react-router";
+
+const AboutPage = () => {
+ return (
+
+
About This Project
+
+
+ ReactJs Boilerplate is a personal starter or boilerplate code I
+ created to help me boostrap my React frontend project quickly
+
+
+ It comes with some best practices such as eslinting, consistent code
+ formatting checks before commiting with husky, testing, styling, CI/CD
+ pipelines with Github Actions, etc
+
+
+
+ Home
+
+
+ );
+};
+
+export default AboutPage;
diff --git a/src/pages/ErrorPage.tsx b/src/pages/ErrorPage.tsx
new file mode 100644
index 0000000..aec9129
--- /dev/null
+++ b/src/pages/ErrorPage.tsx
@@ -0,0 +1,20 @@
+import { useRouteError, UNSAFE_ErrorResponseImpl } from "react-router";
+
+const ErrorPage = () => {
+ const error = useRouteError();
+
+ return (
+
+
Oops!
+
Sorry, an unexpected error has occured.
+
+
+ {(error as UNSAFE_ErrorResponseImpl).statusText ||
+ (error as UNSAFE_ErrorResponseImpl).data}
+
+
+
+ );
+};
+
+export default ErrorPage;
diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx
new file mode 100644
index 0000000..a5f0ef1
--- /dev/null
+++ b/src/pages/Home/index.tsx
@@ -0,0 +1,32 @@
+import { motion } from "framer-motion";
+import { Link } from "react-router";
+
+const HomePage = () => {
+ return (
+
+
+ ⚛️ React Boilerplate
+
+
+ Status: 🟢 In progress.
+
+
+ Learn more
+
+
+ );
+};
+
+export default HomePage;