Skip to content

Commit

Permalink
Merge pull request #152 from aiven/smulis-137
Browse files Browse the repository at this point in the history
feat[coral]: add first dummy application routes
  • Loading branch information
programmiri authored Oct 26, 2022
2 parents dded222 + ff39314 commit c0fec22
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 42 deletions.
3 changes: 2 additions & 1 deletion coral/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"dependencies": {
"@aivenio/design-system": "^18.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.2"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
Expand Down
30 changes: 30 additions & 0 deletions coral/pnpm-lock.yaml

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

3 changes: 0 additions & 3 deletions coral/src/App.module.css

This file was deleted.

18 changes: 0 additions & 18 deletions coral/src/App.test.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions coral/src/App.tsx

This file was deleted.

6 changes: 4 additions & 2 deletions coral/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import { RouterProvider } from "react-router-dom";
import router from "./router";

import "@aivenio/design-system/dist/styles.css";

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<App />
<RouterProvider router={router} />
</React.StrictMode>
);
15 changes: 15 additions & 0 deletions coral/src/pages/hello/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import HelloPage from "./index";
import { render, cleanup, screen } from "@testing-library/react";

describe("HelloPage", () => {
beforeEach(() => {
render(<HelloPage />);
});

afterEach(() => {
cleanup();
});
it("shoud render dummy content", () => {
expect(screen.getByText("Hello")).toBeVisible();
});
});
3 changes: 3 additions & 0 deletions coral/src/pages/hello/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const HelloPage = () => <h1>Hello</h1>;

export default HelloPage;
15 changes: 15 additions & 0 deletions coral/src/pages/index.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import HomePage from "./index";
import { render, cleanup, screen } from "@testing-library/react";

describe("HomePage", () => {
beforeEach(() => {
render(<HomePage />);
});

afterEach(() => {
cleanup();
});
it("shoud render dummy content", () => {
expect(screen.getByText("Index")).toBeVisible();
});
});
3 changes: 3 additions & 0 deletions coral/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const HomePage = () => <h1>Index</h1>;

export default HomePage;
22 changes: 22 additions & 0 deletions coral/src/router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createBrowserRouter, Navigate, RouteObject } from "react-router-dom";
import HomePage from "./pages/index";
import HelloPage from "./pages/hello";

const routes: Array<RouteObject> = [
{
path: "/",
element: <HomePage />,
},
{
path: "/hello",
element: <HelloPage />,
},
{
path: "*",
element: <Navigate to="/" />,
},
];

const router = createBrowserRouter(routes);

export default router;

0 comments on commit c0fec22

Please sign in to comment.