Try more blocks

This commit is contained in:
Samy Pessé
2023-11-01 13:41:14 -04:00
parent 12da9e27bb
commit 07ad0d3909
17 changed files with 156 additions and 37 deletions
@@ -6,7 +6,7 @@ import { DocumentBlockExpandable } from '@gitbook/api';
import { Inlines } from '../Inlines';
export function Expandable(props: BlockProps<DocumentBlockExpandable>) {
const { block, style, context } = props;
const { block, style, ancestorBlocks, context } = props;
const title = getNodeFragmentByType(block, 'expandable-title');
const body = getNodeFragmentByType(block, 'expandable-body');
@@ -16,7 +16,12 @@ export function Expandable(props: BlockProps<DocumentBlockExpandable>) {
<summary className={tcls('cursor-pointer', 'px-4', 'py-3')}>
<Inlines nodes={title.nodes[0].nodes} context={context} />
</summary>
<Blocks nodes={body.nodes} context={context} style={['px-5', 'py-3']} />
<Blocks
nodes={body.nodes}
ancestorBlocks={[...ancestorBlocks, block]}
context={context}
style={['px-5', 'py-3']}
/>
</details>
);
}