Files
gitbook/src/components/DocumentView/BlockContentRef.tsx
T
Samy Pessé e681aa6ba1 Use card for embed and display caption (#61)
* Use card for embed and display caption

* Fix warnings in icon
2023-12-23 22:49:28 +01:00

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