mirror of
https://github.com/Mastermindzh/react-starter-kit.git
synced 2025-08-23 17:44:52 +02:00
Moved examples into example directory
Moved routes to separate file Used route constants
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import deepmerge from "deepmerge";
|
||||
import { RunTimeConfig } from "./RunTimeConfig";
|
||||
|
||||
/**
|
||||
* gets and merges both the regular config and the override config from the window
|
||||
@@ -12,4 +13,4 @@ export const mergeConfigs = () => {
|
||||
|
||||
mergeConfigs();
|
||||
|
||||
export const Config = window.mergedConfig;
|
||||
export const Config: RunTimeConfig = window.mergedConfig;
|
||||
|
@@ -2,12 +2,14 @@ import { DateTime } from "luxon";
|
||||
import { FunctionComponent } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { ROUTE_KEYS } from "../../Routes";
|
||||
import { Config } from "../config";
|
||||
import "./Navbar.css";
|
||||
type Props = {};
|
||||
|
||||
export const Navbar: FunctionComponent<Props> = () => {
|
||||
const [translate, i18n] = useTranslation();
|
||||
const { home, about, counter } = ROUTE_KEYS;
|
||||
return (
|
||||
<>
|
||||
<h1>{translate("navBar.intro")}</h1>
|
||||
@@ -20,13 +22,13 @@ export const Navbar: FunctionComponent<Props> = () => {
|
||||
{/* This translation uses a formatter in the translation files */}
|
||||
<p>{translate("navBar.currentDate", { date: DateTime.now().toJSDate() })}</p>
|
||||
<nav data-testid="nav">
|
||||
<Link to="/" data-testid="nav.home">
|
||||
<Link to={home} data-testid="nav.home">
|
||||
{translate("nav.home")}
|
||||
</Link>
|
||||
<Link to="/about" data-testid="nav.about">
|
||||
<Link to={about} data-testid="nav.about">
|
||||
{translate("nav.about")}
|
||||
</Link>
|
||||
<Link to="/counter" data-testid="nav.counter">
|
||||
<Link to={counter} data-testid="nav.counter">
|
||||
{translate("nav.counter")}
|
||||
</Link>
|
||||
<button onClick={() => i18n.changeLanguage("en")}>en</button>
|
||||
|
Reference in New Issue
Block a user