mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-17 16:15:22 +00:00
30 lines
680 B
TypeScript
30 lines
680 B
TypeScript
import { ContentKitCodeBlock } from '@gitbook/api';
|
|
import React from 'react';
|
|
|
|
import { ContentKitClientElementProps } from './types';
|
|
|
|
export function ElementCodeBlockClient(
|
|
props: ContentKitClientElementProps<ContentKitCodeBlock> & {
|
|
/**
|
|
* Render a code block on the server as a fallback and swap only when needed.
|
|
*/
|
|
children: React.ReactNode;
|
|
},
|
|
) {
|
|
const { element, children } = props;
|
|
|
|
return <>{children}</>;
|
|
}
|
|
|
|
export function DefaultCodeBlock(props: {
|
|
code: string;
|
|
syntax: string;
|
|
lineNumbers: number | boolean;
|
|
}) {
|
|
return (
|
|
<pre>
|
|
<code>{props.code}</code>
|
|
</pre>
|
|
);
|
|
}
|