Skip to content

Commit 967d59b

Browse files
committed
Add button to south panel
1 parent b0b62d6 commit 967d59b

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

packages/mdx/dev/content/copy-button.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,23 @@ function bar() {
3737
```
3838

3939
</CH.Code>
40+
41+
two panels:
42+
43+
<CH.Code>
44+
45+
```js foo.js
46+
function foo() {
47+
return 2
48+
}
49+
```
50+
51+
---
52+
53+
```js bar.js
54+
function bar() {
55+
return 2
56+
}
57+
```
58+
59+
</CH.Code>

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ type EditorFrameProps = {
3030
theme: EditorTheme
3131
terminalPanel?: React.ReactNode
3232
height?: number
33-
button?: React.ReactNode
33+
northButton?: React.ReactNode
34+
southButton?: React.ReactNode
3435
classes?: Classes
3536
onTabClick?: (filename: string) => void
3637
} & React.PropsWithoutRef<JSX.IntrinsicElements["div"]>
@@ -45,7 +46,8 @@ export const EditorFrame = React.forwardRef<
4546
terminalPanel,
4647
style,
4748
height,
48-
button,
49+
northButton,
50+
southButton,
4951
theme,
5052
className,
5153
onTabClick,
@@ -70,7 +72,7 @@ export const EditorFrame = React.forwardRef<
7072
<TabsContainer
7173
tabs={northPanel.tabs}
7274
showFrameButtons={true}
73-
button={button}
75+
button={northButton}
7476
panel="north"
7577
theme={theme}
7678
onTabClick={onTabClick}
@@ -92,6 +94,7 @@ export const EditorFrame = React.forwardRef<
9294
<TabsContainer
9395
tabs={southPanel.tabs}
9496
showFrameButtons={false}
97+
button={southButton}
9598
topBorder={true}
9699
panel="south"
97100
theme={theme}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ function EditorTween({
108108
southPanel={southPanel}
109109
terminalPanel={terminalPanel}
110110
theme={codeConfig.theme}
111-
// TODO same for south
112-
button={<CopyButton content={northContent} />}
111+
northButton={<CopyButton content={northContent} />}
112+
southButton={<CopyButton content={southContent} />}
113113
/>
114114
)
115115
}

packages/mdx/src/smooth-code/copy-button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function CopyButton({
1717
viewBox="0 0 24 24"
1818
xmlns="http://www.w3.org/2000/svg"
1919
>
20+
<title>Copy</title>
2021
<path
2122
strokeLinecap="round"
2223
strokeLinejoin="round"

0 commit comments

Comments
 (0)