mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-23 11:03:39 +00:00
77f769c9c2
* Start fixing TS errors * Continue * Also add dom.iterable * Group header and lint
24 lines
646 B
TypeScript
24 lines
646 B
TypeScript
import { DocumentInlinesRich } from '@gitbook/api';
|
|
|
|
import { DocumentContextProps } from './DocumentView';
|
|
import { Inline } from './Inline';
|
|
import { Text } from './Text';
|
|
|
|
export function Inlines<T extends DocumentInlinesRich>(
|
|
props: DocumentContextProps & { nodes: T[] },
|
|
) {
|
|
const { nodes, ...contextProps } = props;
|
|
|
|
return (
|
|
<>
|
|
{nodes.map((node, index) => {
|
|
if (node.object === 'text') {
|
|
return <Text key={node.key} text={node} />;
|
|
}
|
|
|
|
return <Inline key={node.key} inline={node} {...contextProps} />;
|
|
})}
|
|
</>
|
|
);
|
|
}
|