blob: 5efe1ee3adc429345e858623ebffd7fe83e18a0e (
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
|
import React from "react";
import { Container, Nav } from "react-bootstrap";
import { useHistory, useRouteMatch } from "react-router";
const AdminSubPage: React.FC = ({ children }) => {
const match = useRouteMatch<{ name: string }>();
const history = useHistory();
const name = match.params.name;
function toggle(newTab: string): void {
history.push(`/admin/${newTab}`);
}
return (
<Container>
<Nav variant="tabs" className="my-2">
<Nav.Item>
<Nav.Link
active={name === "users"}
onClick={() => {
toggle("users");
}}
>
Users
</Nav.Link>
</Nav.Item>
</Nav>
{children}
</Container>
);
};
export default AdminSubPage;
|