Skip to content

Commit 772135a

Browse files
committed
Add missing data-ch-theme attributes
1 parent 403e97a commit 772135a

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

packages/mdx/dev/content/test.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ function foobarloremipsumfoobarloremipsumsitametfoobarloremipsumfoobarloremipsum
77
return 8
88
}
99
```
10+
11+
<CH.Preview>
12+
13+
Hello
14+
15+
</CH.Preview>

packages/mdx/src/mdx-client/preview.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
SandboxInfo,
77
} from "@codesandbox/sandpack-client"
88
import { EditorStep } from "../mini-editor"
9+
import { CodeConfig } from "../smooth-code"
910

1011
export type PresetConfig = SandboxInfo
1112
export function Preview({
@@ -16,6 +17,7 @@ export function Preview({
1617
children,
1718
style,
1819
frameless,
20+
codeConfig,
1921
...rest
2022
}: {
2123
className: string
@@ -25,6 +27,7 @@ export function Preview({
2527
show?: string
2628
style?: React.CSSProperties
2729
children?: React.ReactNode
30+
codeConfig?: CodeConfig
2831
}) {
2932
const kids = presetConfig ? (
3033
<SandpackPreview
@@ -40,6 +43,7 @@ export function Preview({
4043
"ch-preview" + (className ? " " + className : "")
4144
}
4245
style={style}
46+
data-ch-theme={codeConfig?.themeName}
4347
>
4448
{frameless ? (
4549
kids

packages/mdx/src/mdx-client/slideshow.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export function Slideshow({
9797
withPreview ? "ch-slideshow-with-preview" : ""
9898
} ${className || ""}`}
9999
style={style}
100+
data-ch-theme={codeConfig.themeName}
100101
>
101102
<div className="ch-slideshow-slide">
102103
<InnerCode

0 commit comments

Comments
 (0)