diff --git a/canon-docs/src/components/CodeBlock/client.tsx b/canon-docs/src/components/CodeBlock/client.tsx new file mode 100644 index 0000000000..27f5bc1a02 --- /dev/null +++ b/canon-docs/src/components/CodeBlock/client.tsx @@ -0,0 +1,24 @@ +'use client'; + +import { CodeBlockProps } from '.'; +import { Text } from '../../../../packages/canon'; +import styles from './styles.module.css'; + +export const CodeBlockClient = ({ + out, + title, +}: { + out: string; + title?: CodeBlockProps['title']; +}) => { + return ( +
+ {title && ( +
+ {title} +
+ )} +
+
+ ); +}; diff --git a/canon-docs/src/components/CodeBlock/index.tsx b/canon-docs/src/components/CodeBlock/index.tsx index bbcf4d63da..4c0fe72960 100644 --- a/canon-docs/src/components/CodeBlock/index.tsx +++ b/canon-docs/src/components/CodeBlock/index.tsx @@ -1,10 +1,8 @@ -import React from 'react'; import type { BundledLanguage } from 'shiki'; import { codeToHtml } from 'shiki'; -import { Text } from '../../../../packages/canon/src/components/Text'; -import styles from './styles.module.css'; +import { CodeBlockClient } from './client'; -interface CodeBlockProps { +export interface CodeBlockProps { lang?: BundledLanguage; title?: string; code?: string; @@ -19,14 +17,5 @@ export async function CodeBlock({ lang = 'tsx', title, code }: CodeBlockProps) { }, }); - return ( -
- {title && ( -
- {title} -
- )} -
-
- ); + return ; } diff --git a/canon-docs/src/mdx-components.tsx b/canon-docs/src/mdx-components.tsx index 182eaa03b4..5eb16edbfe 100644 --- a/canon-docs/src/mdx-components.tsx +++ b/canon-docs/src/mdx-components.tsx @@ -6,7 +6,6 @@ import { Box } from '../../packages/canon/src/components/Box'; export function useMDXComponents(components: MDXComponents): MDXComponents { return { - // Allows customizing built-in components, e.g. to add styling. h1: ({ children }) => (