mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-19 17:15:24 +00:00
7267398d5b
* 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
17 lines
520 B
TypeScript
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} />;
|
|
}
|