Skip to content

Commit

Permalink
Merge pull request #212 from open-rpc/fix/dark-mode-react-json-view
Browse files Browse the repository at this point in the history
fix: dark and light mode on react json view
  • Loading branch information
stevanlohja authored Jun 5, 2019
2 parents f9f3a25 + bc9352d commit 05a74e5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default class App extends React.Component<{}, IState> {
notification: {} as ISnackBarNotification,
parsedSchema: {} as OpenRPC,
reactJsonOptions: {
theme: "summerfruit:inverted",
collapseStringsAfterLength: 25,
displayDataTypes: false,
displayObjectSize: false,
Expand Down Expand Up @@ -114,12 +115,18 @@ export default class App extends React.Component<{}, IState> {
public handleUrlChange = (event: any) => this.debouncedHandleUrlChange(event.target.value);

public handleUISchemaAppBarChange = (name: string) => (value: any) => {
let reactJsonOptions = this.state.reactJsonOptions;
if (name === "ui:darkMode") {
monaco.editor.setTheme(value ? "vs-dark" : "vs");
}
reactJsonOptions = {
...this.state.reactJsonOptions,
theme: value ? "summerfruit" : "summerfruit:inverted",
};
};

this.setState({
...this.state,
reactJsonOptions,
uiSchema: {
...this.state.uiSchema,
appBar: {
Expand Down

0 comments on commit 05a74e5

Please sign in to comment.