Skip to content

Commit 8ce7fca

Browse files
committed
Extract PaneWithCode
1 parent b81f0ea commit 8ce7fca

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

ui/frontend/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ node_modules
2020
!HelpExample.tsx
2121
!Notifications.tsx
2222
!Output/OutputPrism.tsx
23+
!Output/PaneWithCode.tsx
2324
!Output/PaneWithMir.tsx
2425
!Output/SimplePane.tsx
2526
!PopButton.tsx

ui/frontend/Output.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { Focus } from './types';
55

66
import Execute from './Output/Execute';
77
import Gist from './Output/Gist';
8-
import Section from './Output/Section';
9-
import SimplePane, { SimplePaneProps } from './Output/SimplePane';
8+
import SimplePane from './Output/SimplePane';
109
import PaneWithMir from './Output/PaneWithMir';
10+
import PaneWithCode from './Output/PaneWithCode';
1111
import * as selectors from './selectors';
1212
import { useAppDispatch, useAppSelector } from './hooks';
1313

@@ -35,16 +35,6 @@ interface TabProps {
3535
tabProps: object;
3636
}
3737

38-
const PaneWithCode: React.FC<PaneWithCodeProps> = ({ code, ...rest }) => (
39-
<SimplePane {...rest}>
40-
<Section kind="code" label="Result">{code}</Section>
41-
</SimplePane>
42-
);
43-
44-
interface PaneWithCodeProps extends SimplePaneProps {
45-
code?: string;
46-
}
47-
4838
const Output: React.FC = () => {
4939
const somethingToShow = useAppSelector(selectors.getSomethingToShow);
5040
const { meta: { focus }, execute, format, clippy, miri, macroExpansion, assembly, llvmIr, mir, hir, wasm, gist } =
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
3+
import Section from './Section';
4+
import SimplePane, { SimplePaneProps } from './SimplePane';
5+
6+
export interface PaneWithCodeProps extends SimplePaneProps {
7+
code?: string;
8+
}
9+
10+
const PaneWithCode: React.FC<PaneWithCodeProps> = ({ children, code, ...rest }) => (
11+
<SimplePane {...rest}>
12+
<Section kind="code" label="Result">
13+
{code}
14+
</Section>
15+
{children}
16+
</SimplePane>
17+
);
18+
19+
export default PaneWithCode;

0 commit comments

Comments
 (0)