Commit 639d5bf 1 parent bfb66a7 commit 639d5bf Copy full SHA for 639d5bf
File tree 2 files changed +5
-7
lines changed
app/src/systems/Core/components/JsonViewer
2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change 1
1
import type { BaseProps } from '@fuels/ui' ;
2
- import { cx , useRadixTheme } from '@fuels/ui' ;
2
+ import { cx , useTheme } from '@fuels/ui' ;
3
3
import {
4
4
JsonView ,
5
5
collapseAllNested ,
@@ -14,14 +14,14 @@ export type JsonViewerProps = BaseProps<{
14
14
15
15
export function JsonViewer ( { data, className, ...props } : JsonViewerProps ) {
16
16
const classes = styles ( ) ;
17
- const ctx = useRadixTheme ( ) ;
17
+ const { theme } = useTheme ( ) ;
18
18
return (
19
19
< JsonView
20
20
data = { data }
21
21
shouldExpandNode = { collapseAllNested }
22
22
style = {
23
23
{
24
- ...( ctx . appearance === 'dark' ? darkStyles : defaultStyles ) ,
24
+ ...( theme === 'dark' ? darkStyles : defaultStyles ) ,
25
25
container : cx ( classes . json ( ) , className ) ,
26
26
// eslint-disable-next-line @typescript-eslint/no-explicit-any
27
27
} as any
Original file line number Diff line number Diff line change 1
1
'use client' ;
2
2
3
- import { updateThemeAppearanceClass , useThemeContext } from '@radix-ui/themes' ;
3
+ import { updateThemeAppearanceClass } from '@radix-ui/themes' ;
4
4
5
5
const THEME_KEY = 'fuel-ui-theme' ;
6
6
7
7
export function useTheme ( ) {
8
- const { appearance : theme } = useThemeContext ( ) ;
9
-
10
8
function toggleTheme ( ) {
11
9
const current = localStorage . getItem ( THEME_KEY ) ;
12
10
const next = current === 'light' ? 'dark' : 'light' ;
13
11
updateThemeAppearanceClass ( next ) ;
14
12
localStorage . setItem ( THEME_KEY , next ) ;
15
13
}
16
14
17
- return { theme, toggleTheme } ;
15
+ return { theme : localStorage . getItem ( THEME_KEY ) || 'dark' , toggleTheme } ;
18
16
}
You can’t perform that action at this time.
0 commit comments