Skip to content

Commit

Permalink
fix(): Only access window client side.
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanCQ committed Dec 20, 2023
1 parent b2c9be5 commit 65c1609
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/molecules/theme-selector.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use client'
import { ComputerIcon, MoonIcon, SunIcon } from "lucide-react";
import React from "react";
import { theme as _theme } from "src/utils";
import { ToggleGroup, ToggleGroupItem } from "../atoms/toggle-group";

export const useTheme = () => {
const [theme, _setTheme] = React.useState(_theme.get());
const [theme, _setTheme] = React.useState<ReturnType<typeof _theme['get']>>({mode: 'system', isDark: false});
React.useEffect(() => {
_theme.subscribe(() => {
_setTheme(_theme.get());
Expand Down

0 comments on commit 65c1609

Please sign in to comment.