|
1 | 1 | // SPDX-License-Identifier: Apache-2.0 |
2 | 2 | import { Box } from '@mui/system' |
3 | | -import { darkTheme } from '@uiw/react-json-view/dark' |
4 | | -import { theme } from '../../../helpers/theme' |
| 3 | +import { THEME_EXTRA, theme } from '../../../helpers/theme' |
| 4 | +import { githubDarkTheme } from '@uiw/react-json-view/githubDark' |
5 | 5 | import JsonView from '@uiw/react-json-view' |
6 | 6 | import React from 'react' |
7 | 7 |
|
8 | 8 | interface OwnProps { |
9 | 9 | data: object |
10 | | - searchable?: boolean |
11 | | - placeholder?: string |
12 | 10 | } |
13 | 11 |
|
14 | 12 | type JsonViewProps = OwnProps |
15 | 13 |
|
16 | | -darkTheme.background = theme.palette.background.default |
17 | | -darkTheme.backgroundColor = theme.palette.background.default |
18 | | -darkTheme.borderLeftWidth = 2 |
19 | | -darkTheme.borderLeftColor = theme.palette.grey[500] |
20 | | -darkTheme.borderLeftStyle = 'dashed' |
| 14 | +githubDarkTheme.background = theme.palette.background.default |
| 15 | +githubDarkTheme.backgroundColor = theme.palette.background.default |
| 16 | +githubDarkTheme.borderLeftWidth = 2 |
| 17 | +githubDarkTheme.borderLeftColor = theme.palette.grey[500] |
| 18 | +githubDarkTheme.borderLeftStyle = 'dashed' |
| 19 | + |
| 20 | +const mqTheme = { |
| 21 | + ...githubDarkTheme, |
| 22 | + '--w-rjv-info-color': THEME_EXTRA.typography.subdued, |
| 23 | + '--w-rjv-type-null-color': theme.palette.warning.main, |
| 24 | + '--w-rjv-type-boolean-color': theme.palette.error.main, |
| 25 | + '--w-rjv-copied-color': theme.palette.primary.main, |
| 26 | + '--w-rjv-key-string': theme.palette.common.white, |
| 27 | + '--w-rjv-type-string-color': theme.palette.info.main, |
| 28 | + '--w-rjv-ellipsis-color': theme.palette.info.main, |
| 29 | + '--w-rjv-key-number': theme.palette.primary.main, |
| 30 | + '--w-rjv-type-float-color': theme.palette.primary.main, |
| 31 | +} |
21 | 32 |
|
22 | 33 | const MqJsonView: React.FC<JsonViewProps> = ({ data }) => { |
23 | 34 | return ( |
24 | 35 | <Box my={2}> |
25 | | - <JsonView style={darkTheme} collapsed={2} value={data} /> |
| 36 | + <JsonView style={mqTheme} collapsed={2} value={data} /> |
26 | 37 | </Box> |
27 | 38 | ) |
28 | 39 | } |
|
0 commit comments