File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,29 +74,24 @@ const preview: Preview = {
7474 context . globals . theme === "light" ? lightTheme : darkTheme ;
7575
7676 useEffect ( ( ) => {
77+ const root = document . documentElement . style ;
78+
7779 // Apply CSS custom properties to the document root
7880 selectedTheme . forEach ( ( [ property , value ] ) => {
79- document . documentElement . style . setProperty ( property , value ) ;
81+ root . setProperty ( property , value ) ;
8082 } ) ;
83+ root . setProperty ( "--vscode-font-family" , getDefaultFontStack ( ) ) ;
8184
8285 // Cleanup function to remove properties when unmounting
8386 return ( ) => {
8487 selectedTheme . forEach ( ( [ property ] ) => {
85- document . documentElement . style . removeProperty ( property ) ;
88+ root . removeProperty ( property ) ;
8689 } ) ;
90+ root . removeProperty ( "--vscode-font-family" ) ;
8791 } ;
8892 } , [ selectedTheme ] ) ;
8993
90- return createElement (
91- "div" ,
92- {
93- id : "root" ,
94- style : {
95- fontFamily : getDefaultFontStack ( ) ,
96- } ,
97- } ,
98- createElement ( Story ) ,
99- ) ;
94+ return createElement ( "div" , { id : "root" } , createElement ( Story ) ) ;
10095 } ,
10196 ] ,
10297} ;
You can’t perform that action at this time.
0 commit comments