Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenpetryk committed Feb 27, 2024
1 parent 1783957 commit 72150d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/components/CodeAndExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ function CodeAndExample({ collapsible: collapsibleProp = true, example, clean =
const typedExample = example as {
$component: React.ComponentType
$source: string
$reactNode: React.ReactNode
$highlightedSource: React.ReactNode
}
const Component = typedExample.$component
let source = typedExample.$source
const reactNode = typedExample.$reactNode
const highlightedSource = typedExample.$highlightedSource

if (typeof Component !== "function") {
throw new Error(`CodeAndExample: expected example to be a component ${source}`)
Expand Down Expand Up @@ -78,7 +78,7 @@ function CodeAndExample({ collapsible: collapsibleProp = true, example, clean =
`}
>
<pre className={`transition ${expanded ? "" : "opacity-40"}`}>
<code className="language language-tsx">{reactNode}</code>
<code className="language language-tsx">{highlightedSource}</code>
</pre>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/guide-example-loader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default async function guideExampleLoader(source) {
$default.$source = ${JSON.stringify(cleanedSource)};
$default.$component = $default;
$default.$reactNode = toJsxRuntime(${JSON.stringify(tree)}, { Fragment, jsx, jsxs });
$default.$highlightedSource = toJsxRuntime(${JSON.stringify(tree)}, { Fragment, jsx, jsxs });
export default $default;
`
}

0 comments on commit 72150d0

Please sign in to comment.