Skip to content

Commit

Permalink
Fix toggle mode icon mismatch (leerob#304)
Browse files Browse the repository at this point in the history
From the next-theme docs:

When supporting the System theme preference, you want to make sure that's reflected in your UI. This means your buttons, selects, dropdowns, or whatever you use to indicate the current theme should say "System" when the System theme preference is active.

If we didn't distinguish between theme and resolvedTheme, the UI would show "Dark" or "Light", when it should really be "System".
  • Loading branch information
lundgren2 authored Apr 11, 2021
1 parent d699b6e commit 6775171
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Footer from '@/components/Footer';

export default function Container(props) {
const [mounted, setMounted] = useState(false);
const { theme, setTheme } = useTheme();
const { resolvedTheme, setTheme } = useTheme();

// After mounting, we have access to the theme
useEffect(() => setMounted(true), []);
Expand Down Expand Up @@ -63,7 +63,7 @@ export default function Container(props) {
stroke="currentColor"
className="h-4 w-4 text-gray-800 dark:text-gray-200"
>
{theme === 'dark' ? (
{resolvedTheme === 'dark' ? (
<path
strokeLinecap="round"
strokeLinejoin="round"
Expand Down

0 comments on commit 6775171

Please sign in to comment.