- Updated to React 18

- Updated for public release
  - Git was reset for privacy reasons
This commit is contained in:
2022-06-27 16:41:03 +02:00
commit 3cb1759648
68 changed files with 35317 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
type RunTimeConfig = {
version: number;
};
export const Config = (window as any).config as RunTimeConfig;

View File

@@ -0,0 +1,3 @@
nav a {
padding-right: 10px;
}

View File

@@ -0,0 +1,15 @@
import { render, screen } from "@testing-library/react";
import { WithRouter } from "../wrappers/WithRouter";
import { Navbar } from "./Navbar";
describe("Navbar container", () => {
it("renders a navigation section identified by the nav test-id", () => {
render(
<WithRouter>
<Navbar />
</WithRouter>,
);
expect(screen.getAllByTestId("nav")?.length).toBeGreaterThan(0);
});
});

View File

@@ -0,0 +1,19 @@
import { FunctionComponent } from "react";
import { Link } from "react-router-dom";
import { Config } from "../config";
import "./Navbar.css";
type Props = {};
export const Navbar: FunctionComponent<Props> = () => {
return (
<>
<h1>Our fancy header with navigation.</h1>
<p>App version: {JSON.stringify(Config.version)}</p>
<nav data-testid="nav">
<Link to="/">Home</Link> <Link to="/about">About</Link>
<Link to="/counter">Counter</Link>
<hr />
</nav>
</>
);
};

View File

@@ -0,0 +1,8 @@
import { FunctionComponent, ReactNode } from "react";
import { BrowserRouter } from "react-router-dom";
type Props = { children?: ReactNode };
export const WithRouter: FunctionComponent<Props> = ({ children }) => {
return <BrowserRouter>{children}</BrowserRouter>;
};