Skip to content

Commit 1c10f1e

Browse files
committed
fix: update themes for json syntax highlighting
1 parent 5e0f24f commit 1c10f1e

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"minimatch": "3.1.2"
5050
},
5151
"dependencies": {
52-
"@microlink/react-json-view": "^1.26.1",
5352
"@open-rpc/schema-utils-js": "2.1.2"
5453
}
5554
}

packages/playground/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@open-rpc/meta-schema": "^1.14.9",
2727
"@open-rpc/monaco-editor-react": "0.0.0",
2828
"@open-rpc/schema-utils-js": "2.1.2",
29+
"@uiw/react-json-view": "^2.0.0-alpha.30",
2930
"@use-it/interval": "^0.1.3",
3031
"ajv": "^6.10.0",
3132
"classnames": "^2.2.6",

packages/playground/src/App.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import queryParamsStore from './stores/queryParamsStore';
2828
import { useDebounce } from 'use-debounce';
2929
import { initWorkers } from './monacoWorker';
3030
import NewPlaygroundSplitPane from './PlaygroundSplitPane';
31+
import { lightTheme as reactJsonLightTheme } from '@uiw/react-json-view/light';
32+
import { vscodeTheme as reactJsonDarkTheme } from '@uiw/react-json-view/vscode';
3133

3234
const App: React.FC = () => {
3335
const [defaultValue, setDefaultValue] = useDefaultEditorValue();
@@ -78,7 +80,7 @@ const App: React.FC = () => {
7880
useEffect(() => {
7981
setReactJsonOptions({
8082
...reactJsonOptions,
81-
theme: UISchema.appBar['ui:darkMode'] ? 'summerfruit' : 'summerfruit:inverted',
83+
style: UISchema.appBar['ui:darkMode'] ? reactJsonDarkTheme : reactJsonLightTheme,
8284
});
8385
}, [UISchema.appBar['ui:darkMode']]);
8486

@@ -104,12 +106,11 @@ const App: React.FC = () => {
104106
setParsedSchema(defaultValue || '');
105107
}, [defaultValue]);
106108
const [reactJsonOptions, setReactJsonOptions] = useState({
107-
theme: 'summerfruit:inverted',
108-
collapseStringsAfterLength: 25,
109+
style: reactJsonDarkTheme,
110+
shortenTextAfterLength: 25,
109111
displayDataTypes: false,
110112
displayObjectSize: false,
111113
indentWidth: 2,
112-
name: false,
113114
});
114115
const [transportList, setTransportList] = useState(defaultTransports);
115116
const getQueryTransport = () => {
@@ -234,7 +235,7 @@ const App: React.FC = () => {
234235
uiSchema={UISchema}
235236
reactJsonOptions={{
236237
...reactJsonOptions,
237-
theme: UISchema.appBar['ui:darkMode'] ? 'summerfruit' : 'summerfruit:inverted',
238+
style: UISchema.appBar['ui:darkMode'] ? reactJsonDarkTheme : reactJsonLightTheme,
238239
}}
239240
methodPlugins={
240241
UISchema.methods['ui:methodPlugins']

0 commit comments

Comments
 (0)