File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
custom-implementation/src Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -18,16 +18,16 @@ const render = async () => {
18
18
19
19
const data = await getPageData ( )
20
20
const theme = document . getElementsByTagName ( 'html' ) [ 0 ] . getAttribute ( 'class' )
21
- const sidenav = document . querySelector ( 'button.fern-search-bar' )
22
- ?. parentElement as HTMLElement
23
21
24
22
if ( ! document . getElementById ( 'theme-switch' ) ) {
25
- const wrapper = document . createElement ( 'div' )
26
- wrapper . setAttribute ( 'id' , 'theme-switch' )
27
- if ( sidenav ) {
23
+ if ( document . querySelector ( 'button.fern-search-bar' ) !== null ) {
24
+ const sidenav = document . querySelector ( 'button.fern-search-bar' )
25
+ ?. parentElement as HTMLElement
26
+ const wrapper = document . createElement ( 'div' )
27
+ wrapper . setAttribute ( 'id' , 'theme-switch' )
28
28
sidenav . appendChild ( wrapper )
29
+ ReactDOM . render ( React . createElement ( ThemeSwitch ) , wrapper )
29
30
}
30
- ReactDOM . render ( React . createElement ( ThemeSwitch ) , wrapper )
31
31
}
32
32
33
33
ReactDOM . render (
You can’t perform that action at this time.
0 commit comments