Skip to content

Commit 180b85b

Browse files
committed
Update build and update README
1 parent 20229ae commit 180b85b

3 files changed

Lines changed: 20 additions & 18 deletions

File tree

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ import 'react18-json-view/src/style.css'
7575
### CustomizeNode
7676
```ts
7777
(params: { node: any; indexOrName: number | string | undefined; depth: number }) =>
78-
| {
79-
add?: boolean
80-
edit?: boolean
81-
delete?: boolean
82-
enableClipboard?: boolean
83-
collapsed?: boolean
84-
className?: string
85-
}
86-
| React.FC
87-
| typeof React.Component
88-
| React.ReactElement<any, any>
78+
| {
79+
add?: boolean
80+
edit?: boolean
81+
delete?: boolean
82+
enableClipboard?: boolean
83+
collapsed?: boolean
84+
className?: string
85+
}
86+
| React.FC
87+
| typeof React.Component
88+
| React.ReactElement<any, any>
8989
```
9090

9191
## Editable
@@ -150,6 +150,6 @@ react-json-view does not support React 18.
150150
- [ ] display data type
151151
- [ ] display object size
152152
- [ ] handle circle loop
153-
- [x] redesign docs
153+
- [x] redesign docs
154154

155155
* tree?

website/src/contents/themes.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ export default function Themes() {
3131
const [theme, setTheme] = useState(themes[0])
3232
const { theme: glabalTheme } = useTheme()
3333
const currentTheme =
34-
glabalTheme === 'system'
35-
? window.matchMedia('(prefers-color-scheme: dark)').matches
36-
? 'dark'
37-
: 'light'
38-
: glabalTheme
34+
typeof window !== 'undefined'
35+
? glabalTheme === 'system'
36+
? window.matchMedia('(prefers-color-scheme: dark)').matches
37+
? 'dark'
38+
: 'light'
39+
: glabalTheme
40+
: 'light'
3941

4042
const currentBgColor = currentTheme === 'light' ? bgColors[theme] : bgColors_dark[theme]
4143

website/src/lib/storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const setStorage = (key: string, value: string) => {
2-
window.localStorage.setItem(key, value)
2+
if (typeof window !== 'undefined') window.localStorage.setItem(key, value)
33
}
44

55
export const getStorage = (key: string) => {

0 commit comments

Comments
 (0)