Skip to content

Commit

Permalink
theme state refresh issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tymnec committed Nov 9, 2023
1 parent 52bd34a commit 9c54de8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/components/theme_switcher/theme_toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,16 @@ const ThemeSwitcher = ({ props }: any) => {
getWrapperProps,
} = useSwitch(props);

// Depends on Selection
if (!isSelected) {
setTheme("light");
console.log(theme);
} else {
setTheme("dark");
}
// Depends on theme
// Theme Change Function
const toggleTheme = () => {
setTheme(theme === "light" ? "dark" : "light");
};

return (
<div className="flex flex-col gap-2 backdrop:blur">
<div className="font-light text-sm font-mono px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800">
<Component {...getBaseProps()}>
<Component {...getBaseProps()} onClick={toggleTheme}>
<VisuallyHidden>
<input {...getInputProps()} />
</VisuallyHidden>
Expand Down

0 comments on commit 9c54de8

Please sign in to comment.