Skip to content

Commit c388ba6

Browse files
committed
chore(website): Each package includes a link to typedoc API in navigation tree
1 parent dec09b8 commit c388ba6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/documentation/src/constants/navItems.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ import ReactSVGIcon from "icons/ReactSVGIcon";
1515
import createIdGenerator from "utils/createIdGenerator";
1616
import { toTitle } from "utils/toTitle";
1717

18-
import { PACKAGE_NAMES, SCSS_PACKAGES } from "./packages";
18+
import { PACKAGE_NAMES, SCSS_PACKAGES, TYPESCRIPT_PACKAGES } from "./packages";
1919
import {
2020
RouteNavItem,
2121
NavItem,
2222
DividerNavItem,
2323
SubheaderNavItem,
2424
} from "./meta/types";
25+
import { snakeCase } from "lodash";
2526

2627
const uuid = createIdGenerator("nav");
28+
const TSDOCS_PREFIX = "/tsdocs/modules/_react_md_";
2729

2830
const getPackageRoutes = (name: string): RouteNavItem[] => {
2931
const routes: RouteNavItem[] = [];
@@ -52,6 +54,13 @@ const getPackageRoutes = (name: string): RouteNavItem[] => {
5254
children: "Installation",
5355
});
5456

57+
if (name !== "material-icons" && TYPESCRIPT_PACKAGES.includes(name)) {
58+
routes.push({
59+
href: `${TSDOCS_PREFIX}${snakeCase(name)}.html`,
60+
children: "API (typedoc)",
61+
});
62+
}
63+
5564
if (SCSS_PACKAGES.includes(name)) {
5665
routes.push({
5766
href: "/sassdoc",
@@ -226,7 +235,7 @@ function createNavItem(
226235
return tree;
227236
}
228237

229-
if (!navItem.href.startsWith("/")) {
238+
if (!navItem.href.startsWith("/") || navItem.href.startsWith(TSDOCS_PREFIX)) {
230239
const itemId = navItem.href;
231240
tree[itemId] = {
232241
...navItem,

0 commit comments

Comments
 (0)