Skip to content

Commit

Permalink
fix(theme): fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
nanochromatic committed Feb 11, 2024
1 parent 4cc62bc commit ce3b639
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/context/ThemeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export const ThemeProvider = ({
}, []);

useEffect(() => {
// Observe theme change and update React state
// Reactive switching of theme for React components that use the context
const targetNode = document.documentElement;
const observer = new MutationObserver((x) => {
const node = x?.[0].target as HTMLElement;
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class DarkMode {
setDarkMode(darkMode: boolean, doSave = true): void;
inDarkMode(): boolean;
get inDarkMode(): boolean;
}

declare global {
Expand Down

0 comments on commit ce3b639

Please sign in to comment.