fix(electron): theme sync (#2231)

This commit is contained in:
Himself65
2023-05-04 21:00:05 -05:00
committed by GitHub
parent 33c48eed79
commit 1b12972afd
2 changed files with 13 additions and 7 deletions

View File

@@ -1,6 +1,5 @@
import { DarkModeIcon, LightModeIcon } from '@blocksuite/icons';
import { useTheme } from 'next-themes';
import { useEffect } from 'react';
import {
StyledSwitchItem,
@@ -13,11 +12,6 @@ import {
export const MenuThemeModeSwitch = () => {
const { setTheme, resolvedTheme, theme } = useTheme();
useEffect(() => {
if (environment.isDesktop) {
window.apis?.onThemeChange(resolvedTheme === 'dark' ? 'dark' : 'light');
}
}, [resolvedTheme]);
return (
<StyledThemeModeContainer>
<StyledThemeModeSwitch data-testid="change-theme-container" inMenu={true}>