File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import Tippy from "@tippyjs/react";
44import { MdArrowForward } from "react-icons/md" ;
55import "tippy.js/dist/tippy.css" ;
66import "tippy.js/themes/material.css" ;
7+ import { onlyText } from "react-children-utilities" ;
78import styles from "./styles.module.css" ;
89import definitions from "./definitions" ;
910import shortDefinitions from "./short-definitions.js" ;
@@ -15,14 +16,10 @@ import typeMap from "./type-map.js";
1516 * @param {React.ReactNode } props.children
1617 */
1718export default function Term ( { type = null , children } ) {
18- function unwrapNode ( node ) {
19- if ( typeof node === "string" ) return node ;
20- else return unwrapNode ( node . props . children ) ;
21- }
22- if ( type === null ) type = typeMap . get ( unwrapNode ( children ) ) ;
19+ if ( type === null ) type = typeMap . get ( onlyText ( children ) ) ;
2320 if ( ! type )
2421 throw new Error (
25- `Problem: Term ${ children . textContent } is not defined in type-map.js .
22+ `Problem: Term ${ onlyText ( children ) } is not defined in type-map.js .
2623 Solution: explicitly specify term type, or add type definition to type-map.js` ,
2724 ) ;
2825
You can’t perform that action at this time.
0 commit comments