ig-typedoc-theme
Version:
infragistics theme for typedoc API documentation with versioning and localization
26 lines (25 loc) • 1.92 kB
JavaScript
import { JSX, ReflectionKind } from "typedoc";
import { wbr } from "../utils/lib.js";
function renderCategory({ urlTo }, item, prependName = "") {
return (JSX.createElement("section", { class: "tsd-index-section" },
JSX.createElement("h3", null, prependName ? `${prependName} ${item.title}` : item.title),
JSX.createElement("ul", { class: "tsd-index-list", "aria-hidden": "true" }, item.children.map((item) => (JSX.createElement("li", { class: ReflectionKind.classString(item.kind) },
JSX.createElement("a", { href: urlTo(item), class: "tsd-kind-icon" }, item.name ? wbr(item.name) : JSX.createElement("em", null, wbr(ReflectionKind.singularString(item.kind))))))))));
}
export function index(context, props) {
if (props.categories && props.categories.length) {
return (JSX.createElement("section", { class: "tsd-panel-group tsd-index-group" },
JSX.createElement("section", { class: "tsd-panel tsd-index-panel" },
JSX.createElement("div", { class: "tsd-index-content" }, props.categories.map((item) => renderCategory(context, item))))));
}
if (props.groups && props.groups.length) {
return (JSX.createElement("section", { class: "tsd-panel-group tsd-index-group" },
JSX.createElement("section", { class: "tsd-panel tsd-index-panel" },
JSX.createElement("div", { class: "tsd-index-content" }, props.groups.map((item) => (item.categories ? (JSX.createElement("section", { class: "tsd-index-section " + item.title }, item.categories.map((item2) => renderCategory(context, item2, item.title)))) : renderCategory(context, item)))))));
}
else {
return (JSX.createElement("section", { class: "tsd-panel-group tsd-index-group" },
JSX.createElement("section", { class: "tsd-panel tsd-index-panel" },
JSX.createElement("div", { class: "tsd-index-content" }))));
}
}