igniteui-typedoc-theme
Version:
infragistics theme for typedoc API documentation
40 lines (39 loc) • 2.38 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.navigation = void 0;
const lib_1 = require("../utils/lib");
const typedoc_1 = require("typedoc");
function navigation(context, props) {
return (typedoc_1.JSX.createElement(typedoc_1.JSX.Fragment, null,
primaryNavigation(context, props),
secondaryNavigation(context, props)));
}
exports.navigation = navigation;
function primaryNavigation(context, props) {
const modules = props.model.project.getChildrenByKind(typedoc_1.ReflectionKind.SomeModule);
const projectLinkName = modules.some((m) => m.kindOf(typedoc_1.ReflectionKind.Module)) ? "Modules" : "Exports";
return (typedoc_1.JSX.createElement("nav", { class: "tsd-navigation primary" },
typedoc_1.JSX.createElement("ul", null,
typedoc_1.JSX.createElement("li", { class: (0, lib_1.classNames)({ current: props.model.isProject() }) },
typedoc_1.JSX.createElement("a", { href: context.urlTo(props.model.project) }, projectLinkName)))));
}
function secondaryNavigation(context, props) {
const children = props.model instanceof typedoc_1.ContainerReflection ? props.model.children || [] : [];
if (props.model.isProject() && props.model.getChildrenByKind(typedoc_1.ReflectionKind.Module).length) {
return;
}
const pageNavigation = (typedoc_1.JSX.createElement("ul", null, children
.filter((child) => !child.kindOf(typedoc_1.ReflectionKind.SomeModule))
.map((child) => {
return (typedoc_1.JSX.createElement("li", { class: child.cssClasses },
typedoc_1.JSX.createElement("a", { href: context.urlTo(child), class: "tsd-kind-icon" }, (0, lib_1.wbr)(child.name))));
})));
if (props.model.kindOf(typedoc_1.ReflectionKind.SomeModule | typedoc_1.ReflectionKind.Project)) {
return typedoc_1.JSX.createElement("nav", { class: "tsd-navigation secondary menu-sticky" }, pageNavigation);
}
return (typedoc_1.JSX.createElement("nav", { class: "tsd-navigation secondary menu-sticky" },
typedoc_1.JSX.createElement("ul", null,
typedoc_1.JSX.createElement("li", { class: "current " + props.model.cssClasses },
typedoc_1.JSX.createElement("a", { href: context.urlTo(props.model), class: "tsd-kind-icon" }, (0, lib_1.wbr)(props.model.name)),
pageNavigation))));
}