mirror of
https://github.com/Mastermindzh/react-starter-kit.git
synced 2025-10-22 05:15:14 +02:00
- Updated to React 18
- Updated for public release - Git was reset for privacy reasons
This commit is contained in:
3
src/infrastructure/navbar/Navbar.css
Normal file
3
src/infrastructure/navbar/Navbar.css
Normal file
@@ -0,0 +1,3 @@
|
||||
nav a {
|
||||
padding-right: 10px;
|
||||
}
|
15
src/infrastructure/navbar/Navbar.spec.tsx
Normal file
15
src/infrastructure/navbar/Navbar.spec.tsx
Normal 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);
|
||||
});
|
||||
});
|
19
src/infrastructure/navbar/Navbar.tsx
Normal file
19
src/infrastructure/navbar/Navbar.tsx
Normal 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>
|
||||
</>
|
||||
);
|
||||
};
|
Reference in New Issue
Block a user