blob: 47e2138fc1b885352d4df307f1d648dd8d4f83f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import React from "react";
import { Nav } from "react-bootstrap";
import { useTranslation } from "react-i18next";
import { useHistory, useRouteMatch } from "react-router";
const AdminNav: React.FC = () => {
const match = useRouteMatch<{ name: string }>();
const history = useHistory();
const { t } = useTranslation();
const name = match.params.name;
function toggle(newTab: string): void {
history.push(`/admin/${newTab}`);
}
return (
<Nav variant="tabs" className="my-2">
<Nav.Item>
<Nav.Link
active={name === "users"}
onClick={() => {
toggle("users");
}}
>
{t("admin:nav.users")}
</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link
active={name === "more"}
onClick={() => {
toggle("more");
}}
>
{t("admin:nav.more")}
</Nav.Link>
</Nav.Item>
</Nav>
);
};
export default AdminNav;
|