diff --git a/packages/documentation/src/constants/navItems.tsx b/packages/documentation/src/constants/navItems.tsx index 02a479bb51..4c330589bf 100644 --- a/packages/documentation/src/constants/navItems.tsx +++ b/packages/documentation/src/constants/navItems.tsx @@ -15,15 +15,17 @@ import ReactSVGIcon from "icons/ReactSVGIcon"; import createIdGenerator from "utils/createIdGenerator"; import { toTitle } from "utils/toTitle"; -import { PACKAGE_NAMES, SCSS_PACKAGES } from "./packages"; +import { PACKAGE_NAMES, SCSS_PACKAGES, TYPESCRIPT_PACKAGES } from "./packages"; import { RouteNavItem, NavItem, DividerNavItem, SubheaderNavItem, } from "./meta/types"; +import { snakeCase } from "lodash"; const uuid = createIdGenerator("nav"); +const TSDOCS_PREFIX = "/tsdocs/modules/_react_md_"; const getPackageRoutes = (name: string): RouteNavItem[] => { const routes: RouteNavItem[] = []; @@ -52,6 +54,13 @@ const getPackageRoutes = (name: string): RouteNavItem[] => { children: "Installation", }); + if (name !== "material-icons" && TYPESCRIPT_PACKAGES.includes(name)) { + routes.push({ + href: `${TSDOCS_PREFIX}${snakeCase(name)}.html`, + children: "API (typedoc)", + }); + } + if (SCSS_PACKAGES.includes(name)) { routes.push({ href: "/sassdoc", @@ -226,7 +235,7 @@ function createNavItem( return tree; } - if (!navItem.href.startsWith("/")) { + if (!navItem.href.startsWith("/") || navItem.href.startsWith(TSDOCS_PREFIX)) { const itemId = navItem.href; tree[itemId] = { ...navItem,