Files
gitbook/packages/react-contentkit/src/ContentKitOutput.tsx
T
Samy Pessé 70c6c9df42 First pass at implementing ContentKit (#69)
* 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
2024-02-28 14:46:47 +01:00

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