Files
gitbook/src/components/DocumentView/BlockContentRef.tsx
T
Samy Pessé 7267398d5b Use caching for search/ask and rich content for answers (#68)
* Use caching for search/ask

* Refactor DocumentView to be ready to be used for other stuff

* Start logic to use document

* Fix comment

* Remove log

* Format and typecheck
2023-12-25 22:59:14 +01:00

17 lines
520 B
TypeScript

import { DocumentBlockContentRef } from '@gitbook/api';
import { BlockProps } from './Block';
import { Card } from '../primitives';
export async function BlockContentRef(props: BlockProps<DocumentBlockContentRef>) {
const { block, context, style } = props;
const kind = block?.data?.ref?.kind;
const resolved = await context.resolveContentRef(block.data.ref);
if (!resolved) {
return null;
}
return <Card href={resolved.href} preTitle={kind} title={resolved.text} style={style} />;
}