Skip to content

Commit 4adde62

Browse files
committed
Test expand dialog
1 parent c72eca4 commit 4adde62

File tree

2 files changed

+42
-6
lines changed

2 files changed

+42
-6
lines changed

packages/mdx/src/mini-editor/editor-tween.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useTransition, EditorStep } from "./editor-shift"
88
import { CodeConfig } from "../smooth-code"
99
import { useLayoutEffect } from "../utils"
1010
import { CopyButton } from "smooth-code/copy-button"
11+
import { ExpandButton } from "smooth-code/expand-button"
1112

1213
export { EditorTransition, EditorTween }
1314
export type { EditorTransitionProps, EditorTweenProps }
@@ -111,12 +112,7 @@ function EditorTween({
111112
terminalPanel={terminalPanel}
112113
theme={codeConfig.theme}
113114
northButton={
114-
showCopyButton ? (
115-
<CopyButton
116-
content={northContent}
117-
style={{ margin: "0 0.8em" }}
118-
/>
119-
) : undefined
115+
<ExpandButton style={{ margin: "0 0.8em" }} />
120116
}
121117
southButton={
122118
showCopyButton ? (
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from "react"
2+
3+
export function ExpandButton({
4+
style,
5+
}: {
6+
style?: React.CSSProperties
7+
}) {
8+
const [expanded, setExpanded] = React.useState(false)
9+
10+
return (
11+
<>
12+
<svg
13+
style={{
14+
width: "1.5em",
15+
height: "1.5em",
16+
cursor: "pointer",
17+
...style,
18+
}}
19+
onClick={() => {
20+
setExpanded(true)
21+
}}
22+
className="ch-expand-button"
23+
fill="none"
24+
stroke="currentColor"
25+
viewBox="0 0 24 24"
26+
xmlns="http://www.w3.org/2000/svg"
27+
>
28+
<title>Expand</title>
29+
30+
<path
31+
strokeLinecap="round"
32+
strokeLinejoin="round"
33+
strokeWidth={2}
34+
d="M4 8V4m0 0h4M4 4l5 5m11-1V4m0 0h-4m4 0l-5 5M4 16v4m0 0h4m-4 0l5-5m11 5l-5-5m5 5v-4m0 4h-4"
35+
/>
36+
</svg>
37+
<dialog open={expanded}>Hey</dialog>
38+
</>
39+
)
40+
}

0 commit comments

Comments
 (0)