Skip to content

Commit 7ea8115

Browse files
committed
style: update
1 parent bcb04a8 commit 7ea8115

File tree

5 files changed

+216
-86
lines changed

5 files changed

+216
-86
lines changed

example/index.tsx

+39-29
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,66 @@
1-
import 'react-app-polyfill/ie11';
2-
import * as React from 'react';
3-
import * as ReactDOM from 'react-dom';
4-
import JsonEditor from '../.';
5-
// import './reset.css';
1+
import 'react-app-polyfill/ie11'
2+
import 'react-json-syntax-highlighter/dist/ReactJsonSyntaxHighlighter.css'
3+
4+
import * as React from 'react'
5+
import * as ReactDOM from 'react-dom'
6+
import ReactJsonSyntaxHighlighter from 'react-json-syntax-highlighter'
7+
8+
import JsonEditor from '../'
9+
610
const App = () => {
711
const [editObject, setEditObject] = React.useState<any>({
8-
field: 'assignee',
9-
list: [1, 2, 3],
10-
from: {
11-
name: 'zhangsan',
12-
type: 'crazy person',
12+
name: 'may',
13+
age: null,
14+
address: [
15+
'Panyu Shiqiao on Canton',
16+
'Tianhe',
17+
{
18+
city: 'forida meta 11',
19+
},
20+
],
21+
ohters: {
22+
id: 1246,
23+
joinTime: '2017-08-20. 10:20',
24+
description: 'another',
1325
},
14-
tmpFromAccountId: null,
15-
});
26+
})
1627

1728
return (
18-
<div style={{ padding: '10px' }}>
29+
<div>
30+
<h1 style={{ textAlign: 'center', padding: '50px 0' }}>
31+
React Json Edit
32+
</h1>
1933
<div style={{ display: 'flex', justifyContent: 'center' }}>
2034
<div
2135
style={{
2236
width: '550px',
23-
border: '1px solid black',
2437
padding: '10px',
38+
marginRight: '2px',
39+
backgroundColor: '#fcfcfc',
40+
borderRadius: '2px',
2541
}}
2642
>
2743
<JsonEditor
2844
data={editObject}
2945
onChange={data => {
30-
setEditObject(data);
46+
setEditObject(data)
3147
}}
3248
/>
3349
</div>
3450
<div
3551
style={{
36-
width: '600px',
37-
border: '1px solid black',
52+
width: '550px',
3853
padding: '10px',
54+
marginLeft: '2px',
55+
backgroundColor: '#F5F5F5',
56+
borderRadius: '2px',
3957
}}
4058
>
41-
<pre>{JSON.stringify(editObject, null, 2)}</pre>
59+
<ReactJsonSyntaxHighlighter obj={editObject} />
4260
</div>
4361
</div>
4462
</div>
45-
);
46-
};
63+
)
64+
}
4765

48-
ReactDOM.render(<App />, document.getElementById('root'));
49-
// const root = ReactDOM.createRoot(
50-
// document.getElementById('root') as HTMLElement
51-
// );
52-
// root.render(
53-
// <React.StrictMode>
54-
// <App />
55-
// </React.StrictMode>
56-
// );
66+
ReactDOM.render(<App />, document.getElementById('root'))

example/package-lock.json

+126-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "parcel build index.html"
99
},
1010
"dependencies": {
11-
"react-app-polyfill": "^1.0.0"
11+
"react-app-polyfill": "^1.0.0",
12+
"react-json-syntax-highlighter": "^0.1.17"
1213
},
1314
"alias": {
1415
"react": "../node_modules/react",

example/reset.css

-48
This file was deleted.

0 commit comments

Comments
 (0)