|
1 | | -import React, {createElement} from 'react' |
| 1 | +import React from 'react' |
| 2 | +// @ts-expect-error: untyped. |
| 3 | +import {Fragment, jsx, jsxs} from 'react/jsx-runtime' |
2 | 4 | import {apStyleTitleCase} from 'ap-style-title-case' |
3 | | -import {toH} from 'hast-to-hyperscript' |
| 5 | +import {toJsxRuntime} from 'hast-util-to-jsx-runtime' |
4 | 6 | import {sortItems} from './sort.js' |
5 | 7 |
|
| 8 | +const runtime = {Fragment, jsx, jsxs} |
| 9 | + |
6 | 10 | const dateTimeFormat = new Intl.DateTimeFormat('en', {dateStyle: 'long'}) |
7 | 11 |
|
8 | 12 | export function NavGroup(props) { |
@@ -30,12 +34,15 @@ export function NavItem(props) { |
30 | 34 |
|
31 | 35 | if (includeDescription) { |
32 | 36 | if (meta.descriptionHast) { |
33 | | - description = toH(createElement, { |
34 | | - type: 'element', |
35 | | - tagName: 'div', |
36 | | - properties: {className: ['nav-description']}, |
37 | | - children: meta.descriptionHast.children |
38 | | - }) |
| 37 | + description = toJsxRuntime( |
| 38 | + { |
| 39 | + type: 'element', |
| 40 | + tagName: 'div', |
| 41 | + properties: {className: ['nav-description']}, |
| 42 | + children: meta.descriptionHast.children |
| 43 | + }, |
| 44 | + runtime |
| 45 | + ) |
39 | 46 | } else { |
40 | 47 | description = matter.description || meta.description || null |
41 | 48 |
|
|
0 commit comments