Skip to content

Commit 1172c0b

Browse files
Chore: Added adjustable panels for the Editors panels (#5039)
1 parent a6bc057 commit 1172c0b

3 files changed

Lines changed: 30 additions & 12 deletions

File tree

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/playground/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"react-dom": "^18.3.1",
7070
"react-frame-component": "^5.3.2",
7171
"react-is": "^18.3.1",
72+
"react-resizable-panels": "^4.10.0",
7273
"semantic-ui-react": "^2.1.5"
7374
},
7475
"devDependencies": {

packages/playground/src/components/Editors.tsx

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
99
import MonacoEditor from '@monaco-editor/react';
1010
import { ErrorSchema, RJSFSchema, UiSchema } from '@rjsf/utils';
1111
import isEqualWith from 'lodash/isEqualWith';
12+
import { Panel, Group, Separator } from 'react-resizable-panels';
1213

1314
import ThemeSelector, { ThemesType } from './ThemeSelector';
1415
import SubthemeSelector, { SubthemeType } from './SubthemeSelector';
@@ -60,7 +61,7 @@ function Editor({ title, code, onChange }: EditorProps) {
6061
const cls = valid ? 'valid' : 'invalid';
6162

6263
return (
63-
<div className='panel panel-default'>
64+
<div className='panel panel-default' style={{ marginBottom: 0 }}>
6465
<div className='panel-heading'>
6566
<span className={`${cls} glyphicon glyphicon-${icon}`} />
6667
{' ' + title}
@@ -187,22 +188,27 @@ export default function Editors({
187188
</Grid>
188189
</AccordionSummary>
189190
<AccordionDetails sx={{ p: 0 }}>
190-
<Grid container spacing={0.5}>
191-
<Grid size={extraErrors ? 3 : 4}>
191+
<Group orientation='horizontal'>
192+
<Panel defaultSize={extraErrors ? '34%' : '25%'} minSize='10%'>
192193
<Editor title='JSONSchema' code={toJson(schema)} onChange={onSchemaEdited} />
193-
</Grid>
194-
<Grid size={extraErrors ? 3 : 4}>
194+
</Panel>
195+
<Separator style={{ width: '4px', cursor: 'col-resize' }} />
196+
<Panel defaultSize={extraErrors ? '33%' : '25%'} minSize='10%'>
195197
<Editor title={uiSchemaTitle} code={toJson(uiSchema)} onChange={onUISchemaEdited} />
196-
</Grid>
197-
<Grid size={extraErrors ? 3 : 4}>
198+
</Panel>
199+
<Separator style={{ width: '4px', cursor: 'col-resize' }} />
200+
<Panel defaultSize={extraErrors ? '33%' : '25%'} minSize='10%'>
198201
<Editor title='formData' code={toJson(formData)} onChange={onFormDataEdited} />
199-
</Grid>
202+
</Panel>
200203
{extraErrors && (
201-
<Grid size={3}>
202-
<Editor title='extraErrors' code={toJson(extraErrors || {})} onChange={onExtraErrorsEdited} />
203-
</Grid>
204+
<>
205+
<Separator style={{ width: '4px', cursor: 'col-resize' }} />
206+
<Panel defaultSize='25%' minSize='10%'>
207+
<Editor title='extraErrors' code={toJson(extraErrors)} onChange={onExtraErrorsEdited} />
208+
</Panel>
209+
</>
204210
)}
205-
</Grid>
211+
</Group>
206212
</AccordionDetails>
207213
</Accordion>
208214
);

0 commit comments

Comments
 (0)