Skip to content

Commit b701671

Browse files
committed
Use <pre> for output preview in example app
1 parent c2da66e commit b701671

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

example/src/JsonSchemaFormSuite.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
FormBuilder,
1515
PredefinedGallery,
1616
} from '@ginkgo-bioworks/react-json-schema-form-builder';
17+
import withStyles from 'react-jss';
1718
import Tabs from './tabs/Tabs';
1819
import JSONInput from 'react-json-editor-ajrm';
1920
import locale from 'react-json-editor-ajrm/locale/en';
@@ -30,6 +31,7 @@ type Props = {
3031
uischemaTitle?: string,
3132
width?: string,
3233
height?: string,
34+
classes: { [string]: any },
3335
};
3436

3537
type State = {
@@ -55,6 +57,14 @@ function checkError(text: string, language: string) {
5557
return '';
5658
}
5759

60+
const styles = {
61+
codeViewer: {
62+
backgroundColor: 'lightgray',
63+
maxHeight: '550px',
64+
overflowY: 'auto',
65+
},
66+
};
67+
5868
class JsonSchemaFormEditor extends React.Component<Props, State> {
5969
constructor(props: Props) {
6070
super(props);
@@ -210,12 +220,9 @@ class JsonSchemaFormEditor extends React.Component<Props, State> {
210220
errMessage={'Error parsing JSON Schema Form output'}
211221
>
212222
<h4>Output Data</h4>
213-
<JSONInput
214-
id='a_unique_id'
215-
placeholder={this.state.submissionData}
216-
locale={locale}
217-
height='550px'
218-
/>
223+
<pre className={this.props.classes.codeViewer}>
224+
{JSON.stringify(this.state.submissionData, null, 2)}
225+
</pre>
219226
</ErrorBoundary>
220227
<br />
221228
</div>
@@ -344,4 +351,4 @@ class JsonSchemaFormEditor extends React.Component<Props, State> {
344351
}
345352
}
346353

347-
export default JsonSchemaFormEditor;
354+
export default withStyles(styles)(JsonSchemaFormEditor);

0 commit comments

Comments
 (0)