mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-19 17:15:24 +00:00
70c6c9df42
* Start * Try webframe * Lint and format * Move to package * Continue * Implement card and cleanup contexts * Start code blocks * Start rendering image * Continue with card * Start stack * Start text * Start modal * Format * Continue * Fix TS errors * Cleanup * Make markdown work with server components * Format * Add visual test * Lint and format * Fix lifecycle * Implement textinput * Divider * Remove console logs * Remove listSpaceIntegrationsBlocks
24 lines
738 B
TypeScript
24 lines
738 B
TypeScript
import { type ContentKitRenderOutput } from '@gitbook/api';
|
|
|
|
import { Element } from './Element';
|
|
import { ContentKitServerContext } from './types';
|
|
|
|
/**
|
|
* Generic component to render a ContentKit output.
|
|
* The component can be used both as a client and server one.
|
|
*/
|
|
export function ContentKitOutput(props: {
|
|
context: ContentKitServerContext;
|
|
output: ContentKitRenderOutput;
|
|
}) {
|
|
const { output, context } = props;
|
|
return (
|
|
<>
|
|
{process.env.NODE_ENV === 'development' ? (
|
|
<pre style={{ display: 'none' }}>{JSON.stringify(props.output, null, 2)}</pre>
|
|
) : null}
|
|
<Element element={output.element} context={context} state={output.state} />
|
|
</>
|
|
);
|
|
}
|