Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 25x 25x 150x 25x | import { Link, resolvePath, useLocation } from "react-router-dom";
import { Tabs } from "@canonical/react-components";
import routes from "./routes";
function SnapsManagementLayout(): React.JSX.Element {
const { pathname } = useLocation();
const tabsRoutes = routes.find((r) => r.path === ":snapId")?.children ?? [];
const tabsLinks = tabsRoutes.map(({ label, path }) => ({
label,
active: pathname.includes(`/${path}`),
to: resolvePath(path, "./"),
component: Link,
}));
return <Tabs listClassName="u-no-margin--bottom" links={tabsLinks} />;
}
export default SnapsManagementLayout;
|