mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-10-16 13:55:44 -04:00
fix: theme toggle no-op on first click in system mode
Use resolvedTheme instead of theme so the toggle flips what is actually displayed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 file changed
+2
-2
@@ -266,7 +266,7 @@ const ContactPopover = () => (
|
|||||||
|
|
||||||
const Header = ({ className }: { className?: string }) => {
|
const Header = ({ className }: { className?: string }) => {
|
||||||
const [isScrolled, setIsScrolled] = useState(false);
|
const [isScrolled, setIsScrolled] = useState(false);
|
||||||
const { theme, setTheme } = useTheme();
|
const { resolvedTheme, setTheme } = useTheme();
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -330,7 +330,7 @@ const Header = ({ className }: { className?: string }) => {
|
|||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
onClick={() => setTheme(theme === "light" ? "dark" : "light")}
|
onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")}
|
||||||
aria-label="Toggle theme"
|
aria-label="Toggle theme"
|
||||||
className="group"
|
className="group"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in new issue
Block a user