Files
gitbook/src/components/DocumentView/Inlines.tsx
T
Samy Pessé 77f769c9c2 Fix some TS issues and group import during lint (#2)
* Start fixing TS errors

* Continue

* Also add dom.iterable

* Group header and lint
2023-11-12 21:17:18 +01:00

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} />;
})}
</>
);
}