File tree Expand file tree Collapse file tree 2 files changed +5
-12
lines changed
custom-implementation/src/components Expand file tree Collapse file tree 2 files changed +5
-12
lines changed Original file line number Diff line number Diff line change 1
1
'use client'
2
2
3
- import { useEffect , useState , useRef } from 'react'
3
+ import { useEffect , useState } from 'react'
4
4
import {
5
5
ComponentConfigContext ,
6
6
HeaderV30 as SharedHeader ,
@@ -16,17 +16,10 @@ const Header = ({
16
16
} : // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
17
any ) => {
18
18
const html = document . getElementsByTagName ( 'html' ) [ 0 ]
19
- const [ theme , setTheme ] = useState ( html . getAttribute ( 'class' ) || 'light' ) // Default to 'light' if no class is present
20
-
21
- const themeRef = useRef ( theme )
22
- themeRef . current = theme
23
-
19
+ const [ theme , setTheme ] = useState ( html . getAttribute ( 'class' ) )
24
20
useEffect ( ( ) => {
25
21
const observer = new MutationObserver ( ( ) => {
26
- const newTheme = html . getAttribute ( 'class' ) || 'light'
27
- if ( themeRef . current !== newTheme ) {
28
- setTheme ( newTheme )
29
- }
22
+ setTheme ( html . getAttribute ( 'class' ) )
30
23
} )
31
24
32
25
const config = { attributes : true , attributeFilter : [ 'class' ] }
@@ -46,7 +39,7 @@ any) => {
46
39
logo = { logo }
47
40
items = { links }
48
41
actions = { actions }
49
- version = { theme === 'dark' ? 'dark ' : 'light' } // Ensure the theme is correctly reflected
42
+ version = { theme === 'dark' ? 'light ' : 'dark' }
50
43
collapseOnScroll = { collapseOnScroll }
51
44
wrapperClassName = "custom-header"
52
45
/>
Original file line number Diff line number Diff line change 1
1
{
2
2
"organization" : " devrev" ,
3
- "version" : " 0.29 .0"
3
+ "version" : " 0.28 .0"
4
4
}
You can’t perform that action at this time.
0 commit comments