UNPKG

@wordpress/block-library

Version:
33 lines (31 loc) 858 B
import { createElement, Fragment } from "@wordpress/element"; /** * WordPress dependencies */ /** * Internal dependencies */ const ENTRY_CLASS_NAME = 'wp-block-table-of-contents__entry'; export default function TableOfContentsList(_ref) { let { nestedHeadingList } = _ref; return createElement(Fragment, null, nestedHeadingList.map((node, index) => { const { content, link } = node.heading; const entry = link ? createElement("a", { className: ENTRY_CLASS_NAME, href: link }, content) : createElement("span", { className: ENTRY_CLASS_NAME }, content); return createElement("li", { key: index }, entry, node.children ? createElement("ol", null, createElement(TableOfContentsList, { nestedHeadingList: node.children })) : null); })); } //# sourceMappingURL=list.js.map