mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-21 01:53:26 +00:00
e681aa6ba1
* Use card for embed and display caption * Fix warnings in icon
19 lines
576 B
TypeScript
19 lines
576 B
TypeScript
import { DocumentBlockContentRef } from '@gitbook/api';
|
|
|
|
import { resolveContentRef } from '@/lib/references';
|
|
|
|
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 resolveContentRef(block.data.ref, context);
|
|
if (!resolved) {
|
|
return null;
|
|
}
|
|
|
|
return <Card href={resolved.href} preTitle={kind} title={resolved.text} style={style} />;
|
|
}
|